Forms Authentication across virtual directories

Griemiarkchugen

New Member
I am trying to share forms auth from a root application to a sub application running in a virtual directory. I am having trouble with authentication in the subsite.In the parent application everything works as expected. I have the following setup:Parent application:
  • URL: \[code\]http://localhost:1336/\[/code\]
  • \[code\]<forms loginUrl="~/account/sign-in" protection="All" timeout="30" name=".MYAPPLICATION" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="true" defaultUrl="/" />\[/code\]
Virtual Directory:
  • URL: \[code\]http://localhost:1336/subsite\[/code\]
  • \[code\]<forms loginUrl="/account/sign-in" protection="All" timeout="30" name=".MYAPPLICATION" path="/" requireSSL="false" slidingExpiration="true" cookieless="UseDeviceProfile" enableCrossAppRedirects="true" defaultUrl="/" />\[/code\]
When i try to a \[code\]http://localhost:1336/subsite\[/code\] I get the following flow:
  • GET for \[code\]http://localhost:1336/subsite\[/code\] -> 302 to /account/sign-in?ReturnUrl=%2fsubsite (looks ok)
  • Enter User/password
  • POST to \[code\]http://localhost:1336/account/sign-in?ReturnUrl=%2fsubsite\[/code\] -> 302 /subsite (great the auth looks like its successful)
  • GET for \[code\]http://localhost:1336/subsite\[/code\] -> 302 to /account/sign-in?ReturnUrl=%2fsubsite (IE the subsite doesnt think its authenticated)
Also i can see the cookie in the list in my browser (so its actually there)What have I got wrong in my config that's stopping my subsite from sharing the parent cookie?I am running this on IISExpress
 
Back
Top