1

I'm having an asp.net application which uses Forms Authentication.

I've got a master page with some javascript that works fine, but whenever I directed to the LoginUrl, my javascript is blocked. I thought this was authorization issue, but this dose not happen with the CSS of the master page, and even the following directives doesn't help:

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

Has anyone got a clue?? Plz Plz, I'm at a loss here...

Thanx

2
  • 2
    what you mean by blocked? try opening the js address on the browser Commented May 4, 2011 at 8:13
  • This doesn't seem to be an authorization issue. Please post you code of the Login page on how are you using/referring the js files... Commented May 4, 2011 at 9:58

2 Answers 2

2

You maybe referencing the Javascript file wrong (relative directory that cant be resolved correctly from login page)... check if you receive the script files by using FireBug Net tab it can show requests, responses and fails.

Sign up to request clarification or add additional context in comments.

Comments

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

1 Comment

It would probably be better for the user to follow the standards and guidelines of the framework and utilize the web.config file to allow permissions to the script folder instead of placing a hack in the global.asax file. Especially in this case, where the cause of the problem has not been identified.

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.