asp.net-core-3.0

User.Identity.IsAuthenticated = false after login successfully mvc core 3.0 with web api

狂风中的少年 提交于 2020-01-05 07:12:09
问题 this is image obvious the problem. my login function in api public async Task<object> Login([FromBody] LoginDto model) { var user = _context.Users.FirstOrDefault(x => x.Email == model.Email || x.UserName == model.Email); var result = await _signInManager.PasswordSignInAsync(user.UserName, model.Password, model.RememberMe, false); var IsAuthenticate = User.Identity.IsAuthenticated; await _signInManager.SignInAsync(user, model.RememberMe); if (result.Succeeded) { var appUser = _userManager

Issue after migrating from 2.2 to 3.0, default works but can't access area, is there anyway to debug the endpoint resolution?

可紊 提交于 2019-12-25 02:34:49
问题 I migrated an asp.net core 2.2 app to 3.0 today, took a bit but everything recompiles and the front (default) works fine, but i can't access the back (separate area). I have my endpoints specified as such (more specific first as the migration documentation recommends) : app.UseEndpoints(endpoints => endpoints.MapAreaControllerRoute("areas", "areas", "{area:exists}/{controller=Home}/{action=Index}/{id?}"); endpoints.MapControllerRoute("default","{controller=Home}/{action=Index}/{id?}"); });

Is it possible to get a list of RenderFragments when overriding BuildRenderTree?

人走茶凉 提交于 2019-12-25 01:24:49
问题 I'm wondering if it's possible to reference child elements in the ChildContent parameter of a component. I can pass values from parent components to children explicitly or by using a cascading parameter, but there is no great way for a parent component to "know" about elements inside the ChildContent RenderFragment . A possible use-case for this would be a UIList component that gets the number of UIListItems that have been added to the UIList component during the render process. I've

Azure functions runtime exception, the type initializer for system data sqlclient excetion, Unable to load DLL 'sni.dll'

不打扰是莪最后的温柔 提交于 2019-12-24 22:39:17
问题 I am using aspnet core 3.0 and azure function v3-preview with system.data.sqlclient version 4.7.0 When i try to run azure function(on both service queue trigger and time trigger) it gives below error : The type initializer for 'System.Data.SqlClient.TdsParser' threw an exception. The type initializer for 'System.Data.SqlClient.SNILoadHandle' threw an exception. Unable to load DLL 'sni.dll' or one of its dependencies: The specified module could not be found. I tried solutions from below links

User stays logged in after deleting from Azure AD

孤者浪人 提交于 2019-12-24 22:36:05
问题 I've set up a small ASP.NET Core v3 webapp using Microsoft.Identity.Web from https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/tree/master/1-WebApp-OIDC This works fine. But when I log in as userA and then delete this user from our Azure AD, the user stays logged in. How can I forge my app to regularly check if the user still exists or if his roles have changed? From Cookie not expiring for Azure AD auth I understand I can set OpenIdConnectOptions

Mapping Subdomains to Areas in ASP.Net Core 3

半城伤御伤魂 提交于 2019-12-24 10:55:51
问题 What I want to achieve Mapping my normal domain e.g. example.com to no area if possible. Mapping my subdomain e.g. blog.example.com to a area named blog . What I have found There are actually quite a lot of posts regarding to this topic, especially mapping subdomains to areas. From SO: area-and-subdomain-routing asp-net-core-mapping-subdomains-to-areas Others: danylkoweb.com benjii.me web.archive.org And there are probably even more. Problem But there is one big problem, in ASP.Net Core 3

Adding Identityserver authentication to net core 3 app fails with 'Key type not specified.'

南楼画角 提交于 2019-12-24 04:24:09
问题 I'm trying to add Identity server authentication to a dot net core 3 API project. I've added this code public void ConfigureServices(IServiceCollection services) { ... var identityBuilder = services.AddIdentityServer(); identityBuilder.AddApiAuthorization<ApplicationUser, DbContext>(); services .AddAuthentication() .AddIdentityServerJwt(); var fileName = Path.Combine("Certificates", "certificatefile.pfx"); var cert = new X509Certificate2(fileName, "veryDifficultPassword"); identityBuilder

Using RouteDataRequestCultureProvider in asp net core 3.1

喜夏-厌秋 提交于 2019-12-24 03:46:13
问题 Having upgraded from core 2.2 to 3.1 I cannot get RouteDataRequestCultureProvider working fully. Routing works but razor tag helpers are ignoring the culture and route attributes that use culture. As simple example of custom route attribute: public class StaticPageController : Controller { [Route("{culture:culture}/cookies")] public IActionResult Cookies() => View(); } If I go to the url https://localhost:5002/en/cookies the action is routed to correctly. However in razor, if I use a helper

What is equivalent to `MapSpaFallbackRoute` for ASP.NET Core 3.0 endpoints?

我的未来我决定 提交于 2019-12-22 01:50:41
问题 In ASP.NET Core 2.x I used standard routes registation Configure method of Startup class to register fallback route for SPA application using MapSpaFallbackRoute extension method from Microsoft.AspNetCore.SpaServices.Extensions Nuget package: public void Configure(IApplicationBuilder app) { // ... app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapSpaFallbackRoute( name: "spa-fallback", defaults: new { controller = "Home",

Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger`1[WebApplication1.Startup]'

倾然丶 夕夏残阳落幕 提交于 2019-12-21 04:49:06
问题 I created an ASP.NET Core 3.0 Web Application with the default template in Visual Studio 2019 Preview 2.2 and tried to inject an ILogger in Startup: namespace WebApplication1 { public class Startup { private readonly ILogger _logger; public Startup(IConfiguration configuration, ILogger<Startup> logger) { Configuration = configuration; _logger = logger; } // ... } } In Program.cs I also call the ConfigureLogging() method: namespace WebApplication1 { public class Program { public static void