Unable to get login page using master page to display styles with forms authenticatio

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jesposito
    New Member
    • Dec 2010
    • 2

    #1

    Unable to get login page using master page to display styles with forms authenticatio

    I have seen numerous posts with this problem, however none of the solutions have worked for me. I am using asp.net 4.0 forms authentication. I have the following set in my config file.
    Code:
        <authentication mode="Forms">
          <forms loginUrl="~/Account/Login.aspx" />
        </authentication>
        <authorization>
          <deny users="?"/>
        </authorization>
    The login.aspx page uses a master page and styles in a stylesheet located in a folder off the root directory called 'Styles'. I have also add the following to my config file.
    Code:
      <location path="~/Styles">
        <system.web>
          <authorization>
            <allow users = "*"/>
          </authorization>
        </system.web>
      </location>
    When the page displays, the login page displays with the master page content, however all of the styles are missing. When I embed styles into the master page the styles show properly, so I know the problem is that the styles are not being accessed from the file.

    Does anyone know how I can authorize access to the stylesheet?
    Last edited by Frinavale; Dec 9 '10, 03:49 PM. Reason: Please post code in code tags. Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Try placing your login page, and the style used for it, outside of the protected content folder...

    For example, have a folder within your site called "protected" or something where you have placed all of the pages that require authentication in order to access them.

    Place your Login page, and the master page, and the styles outside of the protected folder since everyone can use these resources.

    Now, within the protected folder, add a web.config file that states that all unauthorized people should be denied access and redirected to the login page.

    In the main root of the site, allow everyone access.

    -Frinny

    Comment

    • jesposito
      New Member
      • Dec 2010
      • 2

      #3
      Frinny,

      Thanks for your help. This solved the problem. Just what I needed!

      Jim

      Comment

      Working...