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.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You can adjust it in your web.config file:
<authentication mode="Forms"> <forms name=".CookieName" loginUrl="LoginPage.aspx" /> </authentication>
Method 2
Yes you can specify the cookie name in web.config on forms element under authentication element.
<authentication mode="Forms">
<forms name="RoleBasedAuthenticationCookiename" loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx">
</forms>
</authentication>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0