Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the FormsAuthentication cookie name?

Can I change the FormsAuthentication cookie name?

If yes, How?

The problem which I've got is that when I have two web applications are deployed in the same domain then when anyone is logged in then the second one will be automatically logged out because they use the same Authentication's cookie name.

like image 262
French Boy Avatar asked Jul 12 '11 09:07

French Boy


People also ask

What is FormsAuthentication FormsCookieName?

Remarks. The FormsCookieName property value is set in the configuration file for an ASP.NET application by using the name attribute of the forms configuration element. The FormsCookieName is used to reference the cookie that stores the FormsAuthenticationTicket information.

What is Aspxauth cookie?

The ASPXAUTH cookie is used to determine if a user is authenticated. As far as the location of the cookie, that depends on your browser. If you are using Firefox you can view the cookie by clicking on Tools -> Options -> Privacy. Then scroll down to the domain and expand it to see the cookie and its value.

How does FormsAuthentication SetAuthCookie work?

The SetAuthCookie method adds a forms-authentication ticket to either the cookies collection or the URL if CookiesSupported is false . The forms-authentication ticket supplies forms-authentication information to the next request made by the browser.

What is FormsAuthenticationTicket?

FormsAuthenticationTicket(Int32, String, DateTime, DateTime, Boolean, String, String) Initializes a new instance of the FormsAuthenticationTicket class with cookie name, version, directory path, issue date, expiration date, persistence, and user-defined data.


1 Answers

You can adjust it in your web.config file:

<authentication mode="Forms">   <forms name=".CookieName" loginUrl="LoginPage.aspx" /> </authentication> 
like image 108
twoflower Avatar answered Oct 10 '22 07:10

twoflower