asp.net-core-mvc

Debian: No authentication handler is configured to handle the scheme: Automatic

拜拜、爱过 提交于 2021-02-08 09:25:12
问题 I have some issue like this, but i can't understand how to solve it for Debian. At first, i configure my application as described below app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationScheme =MyAuthSchemeName, CookieName = MyCookiName, AutomaticAuthenticate = true, AutomaticChallenge = false, SlidingExpiration = true, ExpireTimeSpan = TimeSpan.FromDays(1), DataProtectionProvider = DataProtectionProvider.Create(MyApplicationName) }); app.UseJwtBearerAuthentication

Is there a way to serve a Blazor app from a specific controller action in a MVC app?

倾然丶 夕夏残阳落幕 提交于 2021-02-08 05:13:40
问题 I'd like to set up a controller action in a already existing ASP.NET Core 3.0 MVC project to serve a Blazor app. I've seen something similar with other SPA frameworks in the past, the View for the action just includes contains the script tag with the bundle, there's usually some other setup like having the SPA build placed on wwwroot for the MVC project. Looking at the Blazor app it seems similar to some extent, where the index.html file includes the wasm script. But I'm honestly not sure

asp.core page razor enum dropdownlist

给你一囗甜甜゛ 提交于 2021-02-07 19:55:32
问题 I use Asp.Core 2.1 with "Page Razor Crud" and I want into my page show a dropdownlist. Here's my model: public enum EnumStatus { Waiting, [Display(Name = "Development progress")] Progress, Canceled, Refused, Deployed, } public class Improvement { [Key] public int ID { get; set; } public string Title { get; set; } [DataType(DataType.Text)] public string Description { get; set; } public EnumStatus Status { get; set; } } the CRUD Razor Page generated this line: <select asp-for="Improvement

asp.core page razor enum dropdownlist

偶尔善良 提交于 2021-02-07 19:53:24
问题 I use Asp.Core 2.1 with "Page Razor Crud" and I want into my page show a dropdownlist. Here's my model: public enum EnumStatus { Waiting, [Display(Name = "Development progress")] Progress, Canceled, Refused, Deployed, } public class Improvement { [Key] public int ID { get; set; } public string Title { get; set; } [DataType(DataType.Text)] public string Description { get; set; } public EnumStatus Status { get; set; } } the CRUD Razor Page generated this line: <select asp-for="Improvement

Manually creating an HttpContext in ASP.NET Core 2.x

风格不统一 提交于 2021-02-07 14:46:25
问题 I'm trying to render a Razor view to a string from a Hosted Service. By using the IRazorViewEngine I am able to render a view to a string using something like the following: _viewEngine.FindView(actionContext, viewName, false); var viewDictionary = new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()) { Model = model }; var viewContext = new ViewContext( actionContext, viewResult.View, viewDictionary, new TempDataDictionary(actionContext.HttpContext,

Manually creating an HttpContext in ASP.NET Core 2.x

删除回忆录丶 提交于 2021-02-07 14:43:38
问题 I'm trying to render a Razor view to a string from a Hosted Service. By using the IRazorViewEngine I am able to render a view to a string using something like the following: _viewEngine.FindView(actionContext, viewName, false); var viewDictionary = new ViewDataDictionary(new EmptyModelMetadataProvider(), new ModelStateDictionary()) { Model = model }; var viewContext = new ViewContext( actionContext, viewResult.View, viewDictionary, new TempDataDictionary(actionContext.HttpContext,

How does ASP.NET Core determine MIME types and apply different middleware?

依然范特西╮ 提交于 2021-02-07 14:23:14
问题 I use ASP.NET Core MVC and .NET Core 2.0. I have some static files, they have different file types, JPEG, PNG, BMP ... I would like to apply different middleware according to different file types. Such as PNG file I will use ImageCompressMiddleware, BMP file I will use ImageConvertMiddleware. How does ASP.NET Core determine MIME types and apply different middleware? Or according to the file extension. 回答1: Create a FileExtensionContentTypeProvider object in configure section and fill or

How does ASP.NET Core determine MIME types and apply different middleware?

十年热恋 提交于 2021-02-07 14:21:51
问题 I use ASP.NET Core MVC and .NET Core 2.0. I have some static files, they have different file types, JPEG, PNG, BMP ... I would like to apply different middleware according to different file types. Such as PNG file I will use ImageCompressMiddleware, BMP file I will use ImageConvertMiddleware. How does ASP.NET Core determine MIME types and apply different middleware? Or according to the file extension. 回答1: Create a FileExtensionContentTypeProvider object in configure section and fill or

VS 2015 Update 2 - Variable does not exist when debugging, why?

只愿长相守 提交于 2021-02-07 11:32:25
问题 I'm using VS 2015 Update 2 with an asp.net 5 web project configured for debug mode. When I run the project with F5 to debug it and hit a break point, some variables can not be observed in the watch window even when they are in scope. Further, if I hover over such variables no value is displayed. If I use the same visual studio to create an empty web project and add a webform and place the code in the load method, the debugger works fine. That is to say, I can see the variables in the watch

Asp.net Core 2.0 Static files not found error

 ̄綄美尐妖づ 提交于 2021-02-07 07:27:18
问题 Hi guys I am trying to create an ASP.net Core 2.0 web application; I have placed the static files in a folder called Content. I am giving the following path: <link href="@Url.Content("../Content/css/style.css")" rel="stylesheet"> I am getting a 404 - not found error when loading the view. However the GET request path is correct and the file exists in the same path. This is the path to which the GET request is being done: http://localhost:49933/Content/css/style.css I found solutions that