I have published my MVC project to an an IIS 6 server. Running under the application MVCapp. The web project gets the url: http://www.domain.com/MVCapp/.
I use forms login for authentication and got an issue after publishing.
The web.config is as follows:
<authentication mode="Forms">
<forms name="CTWebCookie" loginUrl="~/Account/Login" defaultUrl="~/Home/Index" slidingExpiration="true" protection="All" timeout="20"/>
</authentication>
For example if I run the following code in an action:
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
..everything works great and the user is redirected to http://www.domain.com/MVCapp/Account/Login.
However, when the authentication has timed out – at the next page request the user will be redirected to http://www.domain.com/Account/Login. The application root is not routed and the url points at the IIS root.
How can I make the application resolve the correct url after authorization timeout and why does it work when programamticly signing out not not when it automaticly signs out?
Please advice.
Nevermind, figured it out (stupid mistake), thanks for the help though.
The problem was a javascript on the login page that reloaded the page as target.top in case of asyncronous requests. The url in the javascript hadn’t been resolved correctly.