views:

800

answers:

3

Hi,

I have an IIS website on www.example.com

and a virtual directory at www.example.com/demo/

How can I use the authentication cookie from www.example.com in my virtual directory?

+1  A: 

You are looking for a Single Site Login solution. If the article I linked to doesn't help you, there's plenty more on google when you know what to search for ;)

Tomas Lycken
+1  A: 

A solution would be to use integrated authentication. This way the user look up, and authentication authority used, will be the same accost all sites with the servers on the same domain. If you are using something like basic or kerberos authentication then your authentication will not pass between sites even on the same server and possibly between parts of the site that run under different threads, eg a different app pool.

Use session data in asp or cookies to share session information on the same site between pages. Cookies will work even if the virtual folders are shared in a different pool. Just code around the requirements of your virtual directory, in case its shared between multiple sites.

P.S. If you are already using cookies, just have the code in your virtual be the same as what you are using on the other pages.

What are the additional requirements for the virtual? Is it on the same server?

JustSmith
What if the main website web application uses forms authentication?
Robert Koritnik
+1  A: 

The cookies are shared in the same domain, even shared between applications. I have used the same cookie to share authentication between a Classic ASP app and a .net app without problems.

Just use the same rules to encrypt or store the cookie.

Eduardo Molteni