Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > forms authentication across virtual directories

Reply
Thread Tools

forms authentication across virtual directories

 
 
news.microsoft.com
Guest
Posts: n/a
 
      06-10-2005
Hello Everyone,

Here is my situation:
- build a website with a public portion and multiple secured
applications
- security information is in active directory (user ids) and a database
(roles)
- single-signon is required across all applications

My problem is i can't seem to get single-signon working across multiple
virtual directories ... If i logon i can access secured pages within the
"Logon" virtual directory, but not within other virtual directories ... from
my understanding, as long as the auth cookie's path is "/", it should be
accessible across the entire website .... anyone have any idea what i am
doing wrong? ... here is how i set things up:

VIRTUAL DIRECTORIES
- Public (contains links to the secured applications)
- Logon (if a user access a secured application without logging on, they
will be redirected here)
- Application1 (secured application)
- Application2 (secured application)

PUBLIC VIRTUAL DIRECTORY
- anonymous access in IIS
- web.config has all default setting

LOGON VIRTUAL DIRECTORY
- anonymous access in IIS
- forms authentication

WEB.CONFIG

<authentication mode="Forms">
<forms loginUrl="Default.aspx" name="ldapAuthCookie"
timeout="60" path="/"></forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>

SET AUTH COOKIE CODE (executed when the Logon button is clicked):

Dim authTicket As FormsAuthenticationTicket = New
FormsAuthenticationTicket(1, txtUserName.Text, DateTime.Now,
DateTime.Now.AddMinutes(60), False, "", FormsAuthentication.FormsCookiePath)
Dim encryptedTicket As String =
FormsAuthentication.Encrypt(authTicket)
Dim authCookie As HttpCookie = New
HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
Response.Cookies.Add(authCookie)
Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text,
False))

APPLICATION VIRTUAL DIRECTORIES
- anonymous access in IIS
- forms authentication

WEB.CONFIG

<authentication mode="Forms">
<forms loginUrl="/Logon /Default.aspx"
name="ldapAuthCookie"></forms>
</authentication>
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>


any help would be appreciated

thanks,
john paddington


 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      06-10-2005
You need to configure the <machineKey> element for each virtual directory
so they match:

http://msdn.microsoft.com/library/de...asp?frame=true

And FWIW, some info from the P&P that essentially says the same (but there's
a lot more info too):

http://msdn.microsoft.com/library/de...asp?frame=true

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Hello Everyone,
>
> Here is my situation:
> - build a website with a public portion and multiple secured
> applications
> - security information is in active directory (user ids) and a
> database
> (roles)
> - single-signon is required across all applications
> My problem is i can't seem to get single-signon working across
> multiple virtual directories ... If i logon i can access secured pages
> within the "Logon" virtual directory, but not within other virtual
> directories ... from my understanding, as long as the auth cookie's
> path is "/", it should be accessible across the entire website ....
> anyone have any idea what i am doing wrong? ... here is how i set
> things up:
>
> VIRTUAL DIRECTORIES
> - Public (contains links to the secured applications)
> - Logon (if a user access a secured application without logging
> on, they
> will be redirected here)
> - Application1 (secured application)
> - Application2 (secured application)
> PUBLIC VIRTUAL DIRECTORY
> - anonymous access in IIS
> - web.config has all default setting
> LOGON VIRTUAL DIRECTORY
> - anonymous access in IIS
> - forms authentication
> WEB.CONFIG
>
> <authentication mode="Forms">
> <forms loginUrl="Default.aspx" name="ldapAuthCookie"
> timeout="60" path="/"></forms>
> </authentication>
> <authorization>
> <deny users="?" />
> <allow users="*" />
> </authorization>
> SET AUTH COOKIE CODE (executed when the Logon button is
> clicked):
>
> Dim authTicket As FormsAuthenticationTicket = New
> FormsAuthenticationTicket(1, txtUserName.Text, DateTime.Now,
> DateTime.Now.AddMinutes(60), False, "",
> FormsAuthentication.FormsCookiePath)
> Dim encryptedTicket As String =
> FormsAuthentication.Encrypt(authTicket)
> Dim authCookie As HttpCookie = New
> HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
> Response.Cookies.Add(authCookie)
>
> Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text,
> False))
> APPLICATION VIRTUAL DIRECTORIES
> - anonymous access in IIS
> - forms authentication
> WEB.CONFIG
>
> <authentication mode="Forms">
> <forms loginUrl="/Logon /Default.aspx"
> name="ldapAuthCookie"></forms>
> </authentication>
> <authorization>
> <deny users="?" />
> <allow users="*" />
> </authorization>
> any help would be appreciated
>
> thanks,
> john paddington




 
Reply With Quote
 
 
 
 
news.microsoft.com
Guest
Posts: n/a
 
      06-10-2005
thanks ... worked like a charm


"Brock Allen" <> wrote in message
news: ...
> You need to configure the <machineKey> element for each virtual directory
> so they match:
>
> http://msdn.microsoft.com/library/de...asp?frame=true
>
> And FWIW, some info from the P&P that essentially says the same (but
> there's a lot more info too):
>
> http://msdn.microsoft.com/library/de...asp?frame=true
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
>> Hello Everyone,
>>
>> Here is my situation:
>> - build a website with a public portion and multiple secured
>> applications
>> - security information is in active directory (user ids) and a
>> database
>> (roles)
>> - single-signon is required across all applications
>> My problem is i can't seem to get single-signon working across
>> multiple virtual directories ... If i logon i can access secured pages
>> within the "Logon" virtual directory, but not within other virtual
>> directories ... from my understanding, as long as the auth cookie's
>> path is "/", it should be accessible across the entire website ....
>> anyone have any idea what i am doing wrong? ... here is how i set
>> things up:
>>
>> VIRTUAL DIRECTORIES
>> - Public (contains links to the secured applications)
>> - Logon (if a user access a secured application without logging
>> on, they
>> will be redirected here)
>> - Application1 (secured application)
>> - Application2 (secured application)
>> PUBLIC VIRTUAL DIRECTORY
>> - anonymous access in IIS
>> - web.config has all default setting
>> LOGON VIRTUAL DIRECTORY
>> - anonymous access in IIS
>> - forms authentication
>> WEB.CONFIG
>>
>> <authentication mode="Forms">
>> <forms loginUrl="Default.aspx" name="ldapAuthCookie"
>> timeout="60" path="/"></forms>
>> </authentication>
>> <authorization>
>> <deny users="?" />
>> <allow users="*" />
>> </authorization>
>> SET AUTH COOKIE CODE (executed when the Logon button is
>> clicked):
>>
>> Dim authTicket As FormsAuthenticationTicket = New
>> FormsAuthenticationTicket(1, txtUserName.Text, DateTime.Now,
>> DateTime.Now.AddMinutes(60), False, "",
>> FormsAuthentication.FormsCookiePath)
>> Dim encryptedTicket As String =
>> FormsAuthentication.Encrypt(authTicket)
>> Dim authCookie As HttpCookie = New
>> HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
>> Response.Cookies.Add(authCookie)
>>
>> Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUserName.Text,
>> False))
>> APPLICATION VIRTUAL DIRECTORIES
>> - anonymous access in IIS
>> - forms authentication
>> WEB.CONFIG
>>
>> <authentication mode="Forms">
>> <forms loginUrl="/Logon /Default.aspx"
>> name="ldapAuthCookie"></forms>
>> </authentication>
>> <authorization>
>> <deny users="?" />
>> <allow users="*" />
>> </authorization>
>> any help would be appreciated
>>
>> thanks,
>> john paddington

>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
virtual directories/physical directories in IIS Paul F ASP .Net 4 06-25-2008 04:04 PM
Multiple bin-directories with virtual directories? =?Utf-8?B?TGFzc2UgTmlsc3Nvbg==?= ASP .Net 0 11-09-2004 05:49 PM
Forms Authentication with IIS Virtual Directories Jerry Morton ASP .Net 1 10-14-2004 10:34 AM
Forms Authentication across directories =?Utf-8?B?TmF0aGFuVg==?= ASP .Net 2 10-14-2004 06:11 AM
Using virtual directories for common directories (scripts, images, styles, etc.) Jeffry van de Vuurst ASP .Net 2 07-30-2003 07:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57