Questions tagged [cookie-authentication]
100 questions
1
vote
1 answer
After store JWT token in cookie how to break that cookie and get information in ASP.NET Core 3.1
In my ASP.NET Core 3.1 MVC application I want to store JWT token in cookie then during Authorization I want to break that get user information. This is the code how I store JWT token in cookie.
var tokenHandler = new JwtSecurityTokenHandler();
var…

Limon Safayet
- 69
- 6
1
vote
1 answer
Getting error in _signInManager.PasswordSignInAsync method in .net core 3
I am using CookieAuthenticationDefaults.AuthenticationScheme.
When I try to use signInManager.PasswordSignInAsync method,I am getting this error===>
cookie.Expiration is ignored, use ExpireTimeSpan instead.
How to fix this error ?

Anik Saha
- 4,313
- 2
- 26
- 41
1
vote
0 answers
How to Authenticate .NET MVC on iFrame
I am not experienced in .NET authentication, and haven't found a specific answer for this need.
I am developing a .NET Core 2.1 MVC app which will have to run on an iframe on a different .NET Framework 4.5.1 app, which uses a…

Joao Quental
- 91
- 6
1
vote
0 answers
Sharing authentication cookie between ASP.NET 4.8 and ASP.NET Core 3.1
I followed the steps described on this Microsoft Document but I haven't been able to get the shared auth to work.
I can see that both webapps generate the auth cookie but they end up overwriting each others so auth only works on whichever app you…

NicoTek
- 1,127
- 1
- 14
- 34
1
vote
1 answer
.NET Core 3.1 with Identity - How to set CookieAuthenticationOptions dynamically from SQL Database
Spent many hours on this now and no avail, I want the user to have the flexibility to configure the CookieAuthenticationOptions from within the app. Most of the examples given only set the options in configure services on startup, but this is…

OJB1
- 2,245
- 5
- 31
- 63
1
vote
1 answer
Blazor AuthenticationStateProvider
Is there any way to access authentication state outside Component ?
For example I am trying ,
public class ServersideCurrentUserIdentityProvider : ICurrentUserIdentityProvider, IDisposable
{
private Task…

crypted
- 10,118
- 3
- 39
- 52
1
vote
1 answer
Role based Menu display in cookie authentication with claims identity in asp.net core MVC?
I need the best ways to do role based menu navigation.
My application is in Asp.net core MVC and I have used cookie-based authentication.
And I am using claims identity.

Poonam Londhe
- 11
- 4
1
vote
0 answers
How to avoid session hijacking in MVC5 + Identity? / Invalidate cookie server side
I have a fully working web app made with MVC5 and Aspnet Identity (local accounts + cookie based auth). We ran a security audit in the site and the results showed that our site is vulnerable to session hijacking. The steps to reproduce the…

l_degaray
- 63
- 9
1
vote
1 answer
Getting HTTP 500 when trying to log in using cookie authentication with ASP.NET Identity
ASP.NET Core 2.2
I've wrestled with this problem for a long time...
Whenever I'm trying to anything related to logging in or out through HttpContext I get a HTTP 500 error.
I've scaffolded the identity and done the changes I needed, so I'm more or…

StefanJM
- 1,533
- 13
- 18
1
vote
0 answers
How to extend OWIN Cookie before expiry?
I'm trying to handle ASP.net MVC 5, timeout session scenario. Here is my code I'm using which is working as well for session expiry.
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
ExpireTimeSpan = 200,
…

afr0
- 848
- 1
- 11
- 29
1
vote
0 answers
How to have a single asp.net mvc project with cookie authentication for mvc controllers and token authentication for API controllers
We have an existing asp.net Mvc 5 application having external login with OAuth2 providers like google, and microsoft. We are using CookieAuthenticatoin for this.
Now we need to add ApiContoller to the same application.
Is there any way to use the…

Dinesh
- 119
- 8
1
vote
2 answers
How to make cookie auth scheme generate relative login url instead of absolute one?
When ASP.NET Core authentication scheme redirects to Login Page it sends absolute url to the browser.
Is is possible to make this url relative?

Pavel Voronin
- 13,503
- 7
- 71
- 137
1
vote
0 answers
Asp.Net Core 2.2 Cookie Authentication in micro-service architecture
I have 2 services, one web frontend and another backend. Authentication is done at the backed which includes JWT, Cookie, Session, etc. How does the CookieAuthenticationEvents work in this case, particularly with regards to OnRedirect? Are they…

Kok How Teh
- 3,298
- 6
- 47
- 85
1
vote
0 answers
Prevent automatic windows auth signin after signing out using asp.net core cookie authentication
I am trying to compute and cache claims for windows users using cookie authentication as the default scheme. Below is the account controller I am using for this purpose.
[Route("account"), AllowAnonymous]
public class AccountController :…

Sayan Pal
- 4,768
- 5
- 43
- 82
1
vote
1 answer
Can not perform sign in with cookie authentication
I am trying to sign in and HttpContext.User.Identitiy.IsAuthenticated is always false.
Configure service
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(
options => {
…

Bercovici Adrian
- 8,794
- 17
- 73
- 152