asp.net-identity

SignInManager.SignInAsync does not work ASP.net MVC Identity

青春壹個敷衍的年華 提交于 2020-01-06 08:33:05
问题 I am trying to store User Roles in cookies upon login using Identity "SignInManager.SignInAsync". I'm using the example from here(Section 4): https://docs.microsoft.com/en-us/aspnet/identity/overview/getting-started/introduction-to-aspnet-identity. The error im getting is: *Error CS0305 Using the generic type 'SignInManager<TUser, TKey>' requires 2 type arguments* I tried declaring the Signinmanager with: private readonly SignInManager<ApplicationUser, string> _signInManager; Here is the code

asp.net core 2.2 redirects to login after successful sign in

两盒软妹~` 提交于 2020-01-06 08:02:22
问题 I updated my visual studio 2017 to the latest 15.9.5. I have created an out the box asp.net core 2.2 web mvc project with individual user accounts. I set the db up (update-database from package manager console) and ran the site in IIS Express. All good to this point. Registered a user and could sign in. Deployed the app to IIS - running as an application under the default site and its stuck redirecting back to the login page after successfully signing in. (All deployed correctly - app = no

How to get ASP.NET Identity authentication ticket expiry in Razor Page?

耗尽温柔 提交于 2020-01-06 07:21:43
问题 I'm using identityserver4 with ASP.NET Identity, with a cookie configured with SlidingExpiration = true and ExpireTimeSpan = 20 minutes. I would like to provide the user with a warning when they are about to timeout so am trying to access the ".expiry" value in the cookie. So far I have been able to read an expiry time using the Razor code below. However this is failing to read the correct expiry time when the user refreshes their ticket. According to the Microsoft docs SlidingExpiration

How to get ASP.NET Identity authentication ticket expiry in Razor Page?

天涯浪子 提交于 2020-01-06 07:21:09
问题 I'm using identityserver4 with ASP.NET Identity, with a cookie configured with SlidingExpiration = true and ExpireTimeSpan = 20 minutes. I would like to provide the user with a warning when they are about to timeout so am trying to access the ".expiry" value in the cookie. So far I have been able to read an expiry time using the Razor code below. However this is failing to read the correct expiry time when the user refreshes their ticket. According to the Microsoft docs SlidingExpiration

IdentityServer4 custom AuthenticationHandler can't find all claims for a user

▼魔方 西西 提交于 2020-01-06 06:46:06
问题 I am using the IdentityServer4 sample that uses Asp.Net Identity and EntityFramework. I am trying to create group controls using custom policies based on claims/roles. My problem is that when I try and get the users claims in the authorization handler the claims I am looking for are not returned. Looking at the database in SSMS I find the claims/roles I created are in tables called "AspNetRoles", "AspNetRoleClaims", "AspNetUserClaims" along with the user I created being in "AspNetUsers" and

How to set consent cookie in Blazor Server

拈花ヽ惹草 提交于 2020-01-06 04:30:09
问题 I have a Blazor 3.1 App with Identity where I want to implement a cookie consent banner. In classic ASP .NET Core, there is a nice template for a cookie consent banner. @using Microsoft.AspNetCore.Http.Features @{ var consentFeature = Context.Features.Get<ITrackingConsentFeature>(); var showBanner = !consentFeature?.CanTrack ?? false; var cookieString = consentFeature?.CreateConsentCookie(); } @if (showBanner) { <div class="container"> <div id="cookieConsent" class="alert alert-info alert

Get Current User after SignInStatus.Success

会有一股神秘感。 提交于 2020-01-06 03:42:06
问题 I have a mvc app and I´m using Asp Identity 2.0. I need to change some User information after the login, so I need to get the current user just after login. I´m using the following code var user = UserManager.FindById(User.Identity.GetUserId()); Just after case SignInStatus.Success: But I´m getting null as result. Usually when I use UserManager.FindById(User.Identity.GetUserId()) in the Controllers it works fine. Don´t know what is happening now. 来源: https://stackoverflow.com/questions

Get Current User after SignInStatus.Success

淺唱寂寞╮ 提交于 2020-01-06 03:42:05
问题 I have a mvc app and I´m using Asp Identity 2.0. I need to change some User information after the login, so I need to get the current user just after login. I´m using the following code var user = UserManager.FindById(User.Identity.GetUserId()); Just after case SignInStatus.Success: But I´m getting null as result. Usually when I use UserManager.FindById(User.Identity.GetUserId()) in the Controllers it works fine. Don´t know what is happening now. 来源: https://stackoverflow.com/questions

Unknown column 'Extent1.Discriminator' in 'where clause'

六月ゝ 毕业季﹏ 提交于 2020-01-06 03:35:06
问题 I am using Visual Studio 2013 web form application with MySql database to build a web form application but I have been unable to get passed 'Membership and Role Management'. I used a database first approach for the membership and when I try registering a new user, I get the error message below: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Unknown column 'Extent1.Discriminator' in 'where clause'

╄→尐↘猪︶ㄣ 提交于 2020-01-06 03:35:05
问题 I am using Visual Studio 2013 web form application with MySql database to build a web form application but I have been unable to get passed 'Membership and Role Management'. I used a database first approach for the membership and when I try registering a new user, I get the error message below: Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.