简体   繁体   中英

Create an asp.net authentication cookie with javascript

We have will have a mixed ASP.NET environment with WebForms, MVC and some SPA sections.

Now I would like to implement one of these login forms that just pop up with you hover over the login link. This would require that we can authenticate the user via Web Service call (not an issue). But in order to stay compatible with the rest of the pages, we need to set the ASP.NET authentication cookie in the browser. So that it works for the other pages.

Is that possible?
Or is the only way to use an iframe with the login form that reloads?

You can just set the Auth Cookie on the server side

FormsAuthentication.SetAuthCookie(userName, remeberMe);

and update the login view with a logged-in one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM