Access to external javascript file denied

Discussion in 'ASP .Net' started by NZ Jimmy, Jun 24, 2010.

  1. NZ Jimmy

    NZ Jimmy Guest

    I have a page in an ASP.NET web application that includes an external
    javascript file using a fairly basic script tag:

    <script src="DispatchRuleControl.js" type="text/javascript"></script>

    When running the application on the ASP.NET internal webserver everything
    works fine. When I try to host it on IIS7 however, access to the
    DispatchRuleControl.js file is denied and the request for the js file results
    in a redirect to the login page.

    In the directory where the offending *.js file
    is located, I have an ASP.NET web.config file that contains the following:

    <authorization>
    <allow roles="Administrator" />
    <deny users="*" />
    </authorization>

    If I replace that <deny users="*" /> with a <deny users="?" /> then I can
    get at the javascript file just fine. HOWEVER that also means that logged in
    non administrative users can then access all of the files in this directory
    (definitely not what I want).

    If I leave <deny users="*" /> then when I'm logged in as an administrator I
    can get at any *.aspx and *.ascx files in that directory, but not any *.js
    files ???

    Again, this ONLY happens when hosting the Web Application in IIS 7 - when
    hosting on the Visual Studio internal web server everything runs fine.

    Any ideas?

    Jimmy

    NOTE: I posted a similar thread in the IIS Security ng, but I'm becoming
    more and more convinced this is an ASP.NET issue and not an IIS one... the
    fact that the behaviour is altered by modifying settings in the
    <authorization> section of the web.config are a definite clue...
    NZ Jimmy, Jun 24, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Kamoski
    Replies:
    1
    Views:
    2,451
  2. Ros@
    Replies:
    3
    Views:
    623
  3. Jay
    Replies:
    2
    Views:
    1,082
  4. Mellow Crow
    Replies:
    6
    Views:
    418
    Richard Cornford
    Nov 4, 2005
  5. admyc
    Replies:
    2
    Views:
    234
    Thomas 'PointedEars' Lahn
    Sep 4, 2007
Loading...

Share This Page