5

I am experiencing problems with Forms Authentication. When I try to load my Login.aspx page neither javascript nor stylesheets do not load. Here is part of my web.config file

        <authentication mode="Forms">
        <forms loginUrl="Login.aspx"
               timeout="30"
               name=".ASPXAUTH"
               path="/"
               requireSSL="false"
               slidingExpiration="true"
               defaultUrl="Main.aspx"
               cookieless="UseDeviceProfile" />
    </authentication>

    <authorization>
        <deny users="?" />
    </authorization>

Help me, please, to understand what's happening.

1
  • I suspect that your problem of not loading javascript and CSS is not related to forms authentication. What does FireBug say about those static resources? Commented Sep 10, 2010 at 17:04

2 Answers 2

10

You need to add exceptions to those directories or files in your web.config, underneath the <configuration> element.

<configuration>
  <system.web>
     ...
  </system.web>

  <location path="css">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
</configuration>
Sign up to request clarification or add additional context in comments.

1 Comment

0

Put in Global.asax

Public Sub FormsAuthentication_OnAuthenticate(ByVal sender As Object, ByVal args As FormsAuthenticationEventArgs)
    If args.Context.Request.Path.EndsWith("js") Or args.Context.Request.Path.EndsWith("css") Then
        Dim ObjUser As WindowsIdentity = args.Context.Request.LogonUserIdentity
        Dim ObjPrincipal As WindowsPrincipal = New WindowsPrincipal(ObjUser)
        args.User = ObjPrincipal
    End If
End Sub

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.