init
This commit is contained in:
@@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EmbedImagesMiddlewear", "src\EmbedImagesMiddlewear\EmbedImagesMiddlewear.xproj", "{961D39B1-890E-4210-803B-A6D269BC81BA}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EmbedImagesMiddlewear", "src\EmbedImagesMiddlewear\EmbedImagesMiddlewear.xproj", "{961D39B1-890E-4210-803B-A6D269BC81BA}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "EmbedImagesMiddlewearExample", "src\EmbedImagesMiddlewearExample\EmbedImagesMiddlewearExample.xproj", "{643B859E-8D49-4F84-909E-BE801B05A325}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -22,11 +24,16 @@ Global
|
|||||||
{961D39B1-890E-4210-803B-A6D269BC81BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{961D39B1-890E-4210-803B-A6D269BC81BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{961D39B1-890E-4210-803B-A6D269BC81BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{961D39B1-890E-4210-803B-A6D269BC81BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{961D39B1-890E-4210-803B-A6D269BC81BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
{961D39B1-890E-4210-803B-A6D269BC81BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{643B859E-8D49-4F84-909E-BE801B05A325}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{643B859E-8D49-4F84-909E-BE801B05A325}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{643B859E-8D49-4F84-909E-BE801B05A325}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{643B859E-8D49-4F84-909E-BE801B05A325}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{961D39B1-890E-4210-803B-A6D269BC81BA} = {CD7FBF48-5725-4DA0-B342-1C3319DD3B0A}
|
{961D39B1-890E-4210-803B-A6D269BC81BA} = {CD7FBF48-5725-4DA0-B342-1C3319DD3B0A}
|
||||||
|
{643B859E-8D49-4F84-909E-BE801B05A325} = {CD7FBF48-5725-4DA0-B342-1C3319DD3B0A}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
23
Readme.md
Normal file
23
Readme.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
This is a simple aspnet middlewear that converts your small images to base64 encoded data tags in html.
|
||||||
|
|
||||||
|
I wouldn't actually recommend doing this, I mostly did this to see what is possible in aspnet core middlwear. There is much [evidence](http://davidbcalhoun.com/2011/when-to-base64-encode-images-and-when-not-to/) to suggest that it is a bad idea
|
||||||
|
|
||||||
|
How to use:
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
|
||||||
|
app.UseEmbedImages(env);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Before
|
||||||
|
|
||||||
|
`<img src="/path/to/img.jpg" />`
|
||||||
|
|
||||||
|
## After
|
||||||
|
|
||||||
|
`<img src="data:img/jpeg;base64,=randomdatahere" />`
|
||||||
22
src/EmbedImagesMiddlewear/BclExtensions.cs
Normal file
22
src/EmbedImagesMiddlewear/BclExtensions.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmbedImagesMiddlewear
|
||||||
|
{
|
||||||
|
public static class BclExtensions
|
||||||
|
{
|
||||||
|
private static Regex regexImgSrc = new Regex(@"<img[^>]*?src\s*=\s*[""']?([^'"" >]+?)[ '""][^>]*?>", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
|
||||||
|
|
||||||
|
public static IEnumerable<string> ToImageLinks(this string htmlSource)
|
||||||
|
{
|
||||||
|
var matchesImgSrc = regexImgSrc.Matches(htmlSource);
|
||||||
|
foreach (Match m in matchesImgSrc)
|
||||||
|
{
|
||||||
|
yield return m.Groups[1].Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace EmbedImagesMiddlewear
|
|
||||||
{
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
public Class1()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
82
src/EmbedImagesMiddlewear/init.cs
Normal file
82
src/EmbedImagesMiddlewear/init.cs
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmbedImagesMiddlewear
|
||||||
|
{
|
||||||
|
public class EmbedImages
|
||||||
|
{
|
||||||
|
private readonly IHostingEnvironment env;
|
||||||
|
private RequestDelegate _next;
|
||||||
|
private Regex regexImgSrc = new Regex(@"<img[^>]*?src\s*=\s*[""']?([^'"" >]+?)[ '""][^>]*?>", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
public EmbedImages(RequestDelegate next, IHostingEnvironment env)
|
||||||
|
{
|
||||||
|
_next = next;
|
||||||
|
this.env = env;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Invoke(HttpContext context)
|
||||||
|
{
|
||||||
|
var acceptEncoding = context.Request.Headers["Accept-Encoding"];
|
||||||
|
if (acceptEncoding.ToString().IndexOf("gzip", StringComparison.CurrentCultureIgnoreCase) < 0)
|
||||||
|
{
|
||||||
|
await _next?.Invoke(context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var buffer = new MemoryStream())
|
||||||
|
{
|
||||||
|
var body = context.Response.Body;
|
||||||
|
context.Response.Body = buffer;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _next?.Invoke(context);
|
||||||
|
string bodyText;
|
||||||
|
buffer.Seek(0, SeekOrigin.Begin);
|
||||||
|
using (var reader = new StreamReader(buffer))
|
||||||
|
{
|
||||||
|
bodyText = await reader.ReadToEndAsync();
|
||||||
|
}
|
||||||
|
var urls = bodyText.ToImageLinks();
|
||||||
|
foreach (var url in urls)
|
||||||
|
{
|
||||||
|
var filePath = Path.Combine(env.WebRootPath, url.Insert(0, "."));
|
||||||
|
var file = new FileInfo(filePath);
|
||||||
|
//if (file.Length > this.maxBytes) continue;
|
||||||
|
var contentType = string.Empty;
|
||||||
|
if (new Microsoft.AspNetCore.StaticFiles.FileExtensionContentTypeProvider().TryGetContentType(filePath, out contentType))
|
||||||
|
{
|
||||||
|
var bytes = File.ReadAllBytes(filePath);
|
||||||
|
bodyText = bodyText.Replace(url, $"data:{contentType};base64,{Convert.ToBase64String(bytes)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using (var write = new MemoryStream(Encoding.UTF8.GetBytes(bodyText)))
|
||||||
|
{
|
||||||
|
write.WriteTo(body);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
context.Response.Body = body;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BuilderExtension
|
||||||
|
{
|
||||||
|
public static void UseEmbedImages(this IApplicationBuilder app, IHostingEnvironment env)
|
||||||
|
{
|
||||||
|
app.UseMiddleware<EmbedImages>(env);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,10 @@
|
|||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.6.0"
|
"NETStandard.Library": "1.6.0",
|
||||||
|
"Microsoft.AspNetCore.Http.Abstractions": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.StaticFiles": "1.0.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
@@ -10,4 +13,4 @@
|
|||||||
"imports": "dnxcore50"
|
"imports": "dnxcore50"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
3
src/EmbedImagesMiddlewearExample/.bowerrc
Normal file
3
src/EmbedImagesMiddlewearExample/.bowerrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"directory": "wwwroot/lib"
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace EmbedImagesMiddlewearExample.Controllers
|
||||||
|
{
|
||||||
|
public class HomeController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult About()
|
||||||
|
{
|
||||||
|
ViewData["Message"] = "Your application description page.";
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Contact()
|
||||||
|
{
|
||||||
|
ViewData["Message"] = "Your contact page.";
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>643b859e-8d49-4f84-909e-be801b05a325</ProjectGuid>
|
||||||
|
<RootNamespace>EmbedImagesMiddlewearExample</RootNamespace>
|
||||||
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||||
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<DnxInvisibleContent Include="bower.json" />
|
||||||
|
<DnxInvisibleContent Include=".bowerrc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
||||||
24
src/EmbedImagesMiddlewearExample/Program.cs
Normal file
24
src/EmbedImagesMiddlewearExample/Program.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
|
namespace EmbedImagesMiddlewearExample
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.UseKestrel()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseIISIntegration()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
187
src/EmbedImagesMiddlewearExample/Project_Readme.html
Normal file
187
src/EmbedImagesMiddlewearExample/Project_Readme.html
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Welcome to ASP.NET Core</title>
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
background: #f1f1f1;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #fff;
|
||||||
|
color: #505050;
|
||||||
|
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
|
||||||
|
margin: 1%;
|
||||||
|
min-height: 95.5%;
|
||||||
|
border: 1px solid silver;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header h1 {
|
||||||
|
font-size: 44px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0;
|
||||||
|
padding: 10px 30px 10px 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header span {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 30px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header p {
|
||||||
|
font-size: 20px;
|
||||||
|
color: #fff;
|
||||||
|
background: #007acc;
|
||||||
|
padding: 0 30px;
|
||||||
|
line-height: 50px;
|
||||||
|
margin-top: 25px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#header p a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: underline;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-right: 35px;
|
||||||
|
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
|
||||||
|
}
|
||||||
|
|
||||||
|
#main {
|
||||||
|
padding: 5px 30px;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
width: 21.7%;
|
||||||
|
float: left;
|
||||||
|
margin: 0 0 0 4%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section h2 {
|
||||||
|
font-size: 13px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin: 0;
|
||||||
|
border-bottom: 1px solid silver;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.first {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.first h2 {
|
||||||
|
font-size: 24px;
|
||||||
|
text-transform: none;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.first li {
|
||||||
|
border-top: 1px solid silver;
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.last {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #267cb2;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
clear: both;
|
||||||
|
padding-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer p {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="header">
|
||||||
|
<h1>Welcome to ASP.NET Core</h1>
|
||||||
|
<span>
|
||||||
|
We've made some big updates in this release, so it’s <b>important</b> that you spend
|
||||||
|
a few minutes to learn what’s new.
|
||||||
|
</span>
|
||||||
|
<p>You've created a new ASP.NET Core project. <a href="http://go.microsoft.com/fwlink/?LinkId=518016">Learn what's new</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
|
<div class="section first">
|
||||||
|
<h2>This application consists of:</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Sample pages using ASP.NET Core MVC</li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
|
||||||
|
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section">
|
||||||
|
<h2>How to</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section">
|
||||||
|
<h2>Overview</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section last">
|
||||||
|
<h2>Run & Deploy</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="footer">
|
||||||
|
<p>We would love to hear your <a href="http://go.microsoft.com/fwlink/?LinkId=518015">feedback</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:60245/",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"EmbedImagesMiddlewearExample": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "http://localhost:5000",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
61
src/EmbedImagesMiddlewearExample/Startup.cs
Normal file
61
src/EmbedImagesMiddlewearExample/Startup.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using EmbedImagesMiddlewear;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmbedImagesMiddlewearExample
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public Startup(IHostingEnvironment env)
|
||||||
|
{
|
||||||
|
var builder = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(env.ContentRootPath)
|
||||||
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
||||||
|
.AddEnvironmentVariables();
|
||||||
|
Configuration = builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConfigurationRoot Configuration { get; }
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
// Add framework services.
|
||||||
|
services.AddMvc();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
|
loggerFactory.AddDebug();
|
||||||
|
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
app.UseBrowserLink();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Home/Error");
|
||||||
|
}
|
||||||
|
app.UseEmbedImages(env);
|
||||||
|
app.UseStaticFiles();
|
||||||
|
|
||||||
|
app.UseMvc(routes =>
|
||||||
|
{
|
||||||
|
routes.MapRoute(
|
||||||
|
name: "default",
|
||||||
|
template: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/EmbedImagesMiddlewearExample/Views/Home/About.cshtml
Normal file
7
src/EmbedImagesMiddlewearExample/Views/Home/About.cshtml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "About";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"].</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<p>Use this area to provide additional information.</p>
|
||||||
17
src/EmbedImagesMiddlewearExample/Views/Home/Contact.cshtml
Normal file
17
src/EmbedImagesMiddlewearExample/Views/Home/Contact.cshtml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Contact";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"].</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
One Microsoft Way<br />
|
||||||
|
Redmond, WA 98052-6399<br />
|
||||||
|
<abbr title="Phone">P:</abbr>
|
||||||
|
425.555.0100
|
||||||
|
</address>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||||
|
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||||
|
</address>
|
||||||
110
src/EmbedImagesMiddlewearExample/Views/Home/Index.cshtml
Normal file
110
src/EmbedImagesMiddlewearExample/Views/Home/Index.cshtml
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
|
||||||
|
<ol class="carousel-indicators">
|
||||||
|
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="2"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="3"></li>
|
||||||
|
</ol>
|
||||||
|
<div class="carousel-inner" role="listbox">
|
||||||
|
<div class="item active">
|
||||||
|
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how to build ASP.NET apps that can run anywhere.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<img src="~/images/rose.jpg" />
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
There are powerful new features in Visual Studio for building modern web apps.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner3.svg" alt="Package Management" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner4.svg" alt="Microsoft Azure" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
||||||
|
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Previous</span>
|
||||||
|
</a>
|
||||||
|
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
||||||
|
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Application uses</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Sample pages using ASP.NET Core MVC</li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
|
||||||
|
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>How to</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Overview</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Run & Deploy</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
14
src/EmbedImagesMiddlewearExample/Views/Shared/Error.cshtml
Normal file
14
src/EmbedImagesMiddlewearExample/Views/Shared/Error.cshtml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
|
||||||
|
</p>
|
||||||
67
src/EmbedImagesMiddlewearExample/Views/Shared/_Layout.cshtml
Normal file
67
src/EmbedImagesMiddlewearExample/Views/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - EmbedImagesMiddlewearExample</title>
|
||||||
|
|
||||||
|
<environment names="Development">
|
||||||
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
|
</environment>
|
||||||
|
<environment names="Staging,Production">
|
||||||
|
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css"
|
||||||
|
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||||
|
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||||
|
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||||
|
</environment>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">EmbedImagesMiddlewearExample</a>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
|
||||||
|
<li><a asp-area="" asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container body-content">
|
||||||
|
@RenderBody()
|
||||||
|
<hr />
|
||||||
|
<footer>
|
||||||
|
<p>© 2016 - EmbedImagesMiddlewearExample</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<environment names="Development">
|
||||||
|
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||||
|
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||||
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
|
</environment>
|
||||||
|
<environment names="Staging,Production">
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||||
|
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||||
|
asp-fallback-test="window.jQuery">
|
||||||
|
</script>
|
||||||
|
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js"
|
||||||
|
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||||
|
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
||||||
|
</script>
|
||||||
|
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||||
|
</environment>
|
||||||
|
|
||||||
|
@RenderSection("scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
@using EmbedImagesMiddlewearExample
|
||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
3
src/EmbedImagesMiddlewearExample/Views/_ViewStart.cshtml
Normal file
3
src/EmbedImagesMiddlewearExample/Views/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
10
src/EmbedImagesMiddlewearExample/appsettings.json
Normal file
10
src/EmbedImagesMiddlewearExample/appsettings.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": false,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Debug",
|
||||||
|
"System": "Information",
|
||||||
|
"Microsoft": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/EmbedImagesMiddlewearExample/bower.json
Normal file
10
src/EmbedImagesMiddlewearExample/bower.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "asp.net",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bootstrap": "3.3.6",
|
||||||
|
"jquery": "2.2.0",
|
||||||
|
"jquery-validation": "1.14.0",
|
||||||
|
"jquery-validation-unobtrusive": "3.2.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/EmbedImagesMiddlewearExample/bundleconfig.json
Normal file
24
src/EmbedImagesMiddlewearExample/bundleconfig.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// Configure bundling and minification for the project.
|
||||||
|
// More info at https://go.microsoft.com/fwlink/?LinkId=808241
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"outputFileName": "wwwroot/css/site.min.css",
|
||||||
|
// An array of relative input file paths. Globbing patterns supported
|
||||||
|
"inputFiles": [
|
||||||
|
"wwwroot/css/site.css"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"outputFileName": "wwwroot/js/site.min.js",
|
||||||
|
"inputFiles": [
|
||||||
|
"wwwroot/js/site.js"
|
||||||
|
],
|
||||||
|
// Optionally specify minification options
|
||||||
|
"minify": {
|
||||||
|
"enabled": true,
|
||||||
|
"renameLocals": true
|
||||||
|
},
|
||||||
|
// Optinally generate .map file
|
||||||
|
"sourceMap": false
|
||||||
|
}
|
||||||
|
]
|
||||||
66
src/EmbedImagesMiddlewearExample/project.json
Normal file
66
src/EmbedImagesMiddlewearExample/project.json
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "platform"
|
||||||
|
},
|
||||||
|
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Razor.Tools": {
|
||||||
|
"version": "1.0.0-preview2-final",
|
||||||
|
"type": "build"
|
||||||
|
},
|
||||||
|
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
|
||||||
|
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Configuration.Json": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Console": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Logging.Debug": "1.0.0",
|
||||||
|
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
|
||||||
|
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
|
||||||
|
"EmbedImagesMiddlewear": "1.0.0-*"
|
||||||
|
},
|
||||||
|
|
||||||
|
"tools": {
|
||||||
|
"BundlerMinifier.Core": "2.0.238",
|
||||||
|
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
|
||||||
|
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"netcoreapp1.0": {
|
||||||
|
"imports": [
|
||||||
|
"dotnet5.6",
|
||||||
|
"portable-net45+win8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"buildOptions": {
|
||||||
|
"emitEntryPoint": true,
|
||||||
|
"preserveCompilationContext": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"runtimeOptions": {
|
||||||
|
"configProperties": {
|
||||||
|
"System.GC.Server": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"publishOptions": {
|
||||||
|
"include": [
|
||||||
|
"wwwroot",
|
||||||
|
"Views",
|
||||||
|
"Areas/**/Views",
|
||||||
|
"appsettings.json",
|
||||||
|
"web.config"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"scripts": {
|
||||||
|
"prepublish": [ "bower install", "dotnet bundle" ],
|
||||||
|
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/EmbedImagesMiddlewearExample/web.config
Normal file
14
src/EmbedImagesMiddlewearExample/web.config
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
|
||||||
|
-->
|
||||||
|
|
||||||
|
<system.webServer>
|
||||||
|
<handlers>
|
||||||
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
|
||||||
|
</handlers>
|
||||||
|
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
1
src/EmbedImagesMiddlewearExample/wwwroot/.gitignore
vendored
Normal file
1
src/EmbedImagesMiddlewearExample/wwwroot/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
lib/
|
||||||
6
src/EmbedImagesMiddlewearExample/wwwroot/_references.js
Normal file
6
src/EmbedImagesMiddlewearExample/wwwroot/_references.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/// <autosync enabled="true" />
|
||||||
|
/// <reference path="js/site.js" />
|
||||||
|
/// <reference path="lib/bootstrap/dist/js/bootstrap.js" />
|
||||||
|
/// <reference path="lib/jquery/dist/jquery.js" />
|
||||||
|
/// <reference path="lib/jquery-validation/dist/jquery.validate.js" />
|
||||||
|
/// <reference path="lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js" />
|
||||||
38
src/EmbedImagesMiddlewearExample/wwwroot/css/site.css
Normal file
38
src/EmbedImagesMiddlewearExample/wwwroot/css/site.css
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
body {
|
||||||
|
padding-top: 50px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapping element */
|
||||||
|
/* Set some basic padding to keep content from hitting the edges */
|
||||||
|
.body-content {
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set widths on the form inputs since otherwise they're 100% wide */
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
max-width: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Carousel */
|
||||||
|
.carousel-caption p {
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make .svg files in the carousel display properly in older browsers */
|
||||||
|
.carousel-inner .item img[src$=".svg"]
|
||||||
|
{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide/rearrange for smaller screens */
|
||||||
|
@media screen and (max-width: 767px) {
|
||||||
|
/* Hide captions */
|
||||||
|
.carousel-caption {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/EmbedImagesMiddlewearExample/wwwroot/css/site.min.css
vendored
Normal file
1
src/EmbedImagesMiddlewearExample/wwwroot/css/site.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}input,select,textarea{max-width:280px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}@media screen and (max-width:767px){.carousel-caption{display:none}}
|
||||||
BIN
src/EmbedImagesMiddlewearExample/wwwroot/favicon.ico
Normal file
BIN
src/EmbedImagesMiddlewearExample/wwwroot/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 9.5 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.2 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 12 KiB |
BIN
src/EmbedImagesMiddlewearExample/wwwroot/images/rose.jpg
Normal file
BIN
src/EmbedImagesMiddlewearExample/wwwroot/images/rose.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
1
src/EmbedImagesMiddlewearExample/wwwroot/js/site.js
Normal file
1
src/EmbedImagesMiddlewearExample/wwwroot/js/site.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// Write your Javascript code.
|
||||||
0
src/EmbedImagesMiddlewearExample/wwwroot/js/site.min.js
vendored
Normal file
0
src/EmbedImagesMiddlewearExample/wwwroot/js/site.min.js
vendored
Normal file
Reference in New Issue
Block a user