0
votes

I have an application in a virtual directory (ASP.Net 4.0 C#). It is secured with forms authentication. Within my application are sub directories so that I have a content tree that matches the rough order of my website

www.server.com/application/sub-directory1/sub-directory2/

 <forms name=".ADAuthCookie" loginUrl="Login.aspx" slidingExpiration="true" timeout="100" defaultUrl="~/Default.aspx"/>

What should the "loginUrl" be to allow it to work from a subdirectory? i.e. if your session times out, how can you get the loginUrl to redirect you to the right place?

if you set it to loginUrl="~/Login.aspx" and you are in sub-directory 1, it redirects you to www.server.com/application/sub-directory1/login.aspx which does not exist. I want it to always redirect to www.server.com/application/login.aspx

Thanks

2

2 Answers

0
votes

Did you configure the loginUrl inside the web.config file located at the root folder? If so that should work. I have an asp.net 3.5 with a similar structure. When I timeout inside http://localhost/Providence /Member/Mail/NewMessage.aspx, I am redirected to http://localhost/Providence/Login.aspx?ReturnUrl=%2fProvidence%2fMember%2fMail%2fNewMessage.aspx.

I have not tried this with asp.net 4.0 though.

0
votes

I had the same problem I i fixed it by removing from appSettings section