ASP.NET Forms Authentication prevents loading javascript on Login.aspx

前端 未结 2 1915
说谎
说谎 2020-12-17 03:05

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 fil

相关标签:
2条回答
  • 2020-12-17 03:28

    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>
    
    0 讨论(0)
  • 2020-12-17 03:32

    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
    
    0 讨论(0)
提交回复
热议问题