ASP.NET Login Page Styles

- 1 answer

I have created a user login page and am using Forms Authentication. Users are required to log into the system to use it, there are no anon pages. When the go into the system and get automatically redirected to the login page though, they loose all styles on the page. It is as if the paths to all the css files is incorrect. For all other pages it is ok, just when automatically directed to login.aspx there is a problem. Has anyone else seen and fixed this problem.



The problem may come from the fact all your application (except login.aspx) is protected. So when the user is redirected to login.aspx there are other urls which are retrieved in an anonymous way. For instance, if the user tries to get "~/StyleSheets/default.css" then the web server will return an invisible unauthorized response.

You should try something like that in your web.config file:

<location path="StyleSheets" >
      <allow users="*" />