asp.net-core-mvc

ASP.NET Core Script Tag Helper asp-fallback-src fails integrity check

旧巷老猫 提交于 2020-12-01 10:14:43
问题 I'm receiving the following error when I test falling back to a local file using the ASP.NET Core Script Tag Helper: Failed to find a valid digest in the 'integrity' attribute for resource 'http://localhost:48888/js/jquery.min.js' with computed SHA-256 integrity 'oozPintQUive6gzYPN7KIhwY/B+d8+5rPTxI1ZkgaFU='. The resource has been blocked. The local file is text equal to the CDN version, but is not binary equal. This becomes a problem because the integrity hash is compared against not only

Create text file and download without saving on server in ASP.net Core MVC 2.1

百般思念 提交于 2020-12-01 10:06:28
问题 I've found a way to create a text file then instantly download it in the browser without writing it to the server in regular ASP.net: Create text file and download The accepted answer uses: using (StreamWriter writer = new StreamWriter(Response.OutputStream, Encoding.UTF8)) { writer.Write("This is the content"); } I need to do this in ASP.net Core 2.1 MVC - though in that doesn't know what Response.OutputStream is - and I can't find anything on Google to help with that, or other ways to do

Create text file and download without saving on server in ASP.net Core MVC 2.1

[亡魂溺海] 提交于 2020-12-01 10:04:10
问题 I've found a way to create a text file then instantly download it in the browser without writing it to the server in regular ASP.net: Create text file and download The accepted answer uses: using (StreamWriter writer = new StreamWriter(Response.OutputStream, Encoding.UTF8)) { writer.Write("This is the content"); } I need to do this in ASP.net Core 2.1 MVC - though in that doesn't know what Response.OutputStream is - and I can't find anything on Google to help with that, or other ways to do

How to check if a section in MVC Core configuration file exist?

偶尔善良 提交于 2020-11-29 04:20:37
问题 How can I check if a specific section in loaded ASP.NET Core configuration file exist? I have a JSON configuration file that I load it in Startup class via ConfigurationBuilder.AddJsonFile method. This JSON file is an array with this layout: { "Url": "", "Regex": [ "", "" ], "Keys": { "Title": "", "Description": "", "Keywords": [ "" ] } } But some of them doesn't have Keys . I tried to check return type of section.GetSection("Keys") against null , But it doesn't return null even if Keys