Replies: 1 comment
-
No, Windows Auth does not offer a sign out option. Many times even the sign-in is implicit. If the user was prompted for credentials by the browser then the only way to sign out is to close the browser. If they were not prompted for credentials then there's no real way to sign out. The code you linked is for Asp.Net 4.x, not Asp.Net Core, many of the APIs are different. For example Request.Cookies returns strings, not HttpCookies. IsAuthenticated is on the User. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am making an intranet web application for internal use using ASP.NET Core 3.1 MVC that's using Windows authentication and working on a logout/login page. I am trying to include a function that allows user to logout and sign in as another user.
I inserted this script in
_Layout.cshtml
but the@User.Identity.Name
still shows the original name on the web page, indicating that I haven't logged out and I can still access the pages with[Authorize]
attribute, is there another way to logout user?Also, is there an ASP.NET Core 3.1 version of this answer? When I try to insert this as a function into the controller, errors appear saying
HttpCookie
,Request.IsAuthenticated
,Response.Cookies.Set(cookie)
and functions alike are undefined. Am I missing a NuGet package or library here? Do I have to logout the user to use this "sign in as another user" function?Thanks in advance.
launchSettings.json
Controllers\LogoutController.cs
Views\Logout\ _Layout.cshtml
Beta Was this translation helpful? Give feedback.
All reactions