Wednesday, July 24, 2013

Automatic sign out problem in ASP.NET

Have you ever worked with two ASP.NET sites under “Default Web Site” and signing in into two sites? One of the sites gets automatically sign out. This is a silly problem I was having while showing two sites from my development machine. The problem was happening because I was using same name for “forms” tag in web.config file. Here is how we define forms authentication in web.config file:

<forms loginUrl="~/" timeout="2880" name="SameName" />

If you have two sites where name of forms tag is same, you will be sign out from one site as soon as you sign in into other site.

The solution is use different name for forms tag as long as the parent site is same.

Hope it saves your time!

No comments: