ASP.NET Login Page Styles

I have created a user login page and am using forms authentication. Users must be logged in to use it, there are no anonymous pages. When you login and are automatically redirected to the login page, they lose all styles on the page. It looks like the paths to all css files are wrong. For all other pages, this is fine, just an issue arises when automatically pointing to login.aspx. Has anyone else seen and fixed this issue.

0


source to share


1 answer


The problem may arise because your entire application (except login.aspx) is protected. So when the user is redirected to login.aspx, there are other urls that are fetched anonymously. For example, if the user tries to get "~ / StyleSheets / default.css" then the web server will return an invisible unauthorized response.

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



<location path="StyleSheets" >
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
</location>

      

+5


source







All Articles