简体   繁体   中英

asp.net mvc, IIS 6 vs IIS7.5, and integrated windows authentication causing javascript errors?

This is a very strange one.

I have an asp.net MVC 1 app. Under IIS6, with no anon access - only integrated windows auth - every thing works fine. I have the following on most of my Foo pages:

  <% using (Html.BeginForm())
     { %>
  Show All:
  <%= Html.CheckBox("showAll", new { onClick = "$(this).parent('form:first').submit();" })%>
  <% } %>

Clicking on the checkbox causes a post, the page is reloaded, everything is good.

When I look at the access logs, that's what I see, with one oddity - the js library is requested during the page first request, but not for any subsequent page requests. Log looks like:

GET / 401
GET / 200
GET /Content/Site.css 304
GET /Scripts/jquery-1.3.2.min.js 401
GET /Scripts/jquery-ui-1.7.2.custom.min.js 401
GET /Scripts/jquery.tablesorter.min.js 401
GET /Scripts/jquery-1.3.2.min.js 304
GET /Scripts/jquery-ui-1.7.2.custom.min.js 304
GET /Scripts/jquery.tablesorter.min.js 304
GET /Content/Images/logo.jpg 401
GET /Content/Images/logo.jpg 304

GET /Foo 401
GET /Foo 200
POST /Foo/Delete 302
GET /Foo/List 200
POST /Foo/List 200

This corresponds to home page, click on "Foo", delete a record, click a checkbox (which causes the 2nd POST).

Under IIS7.5, it sometimes fails - the click on the check box doesn't cause a postback, but there are no obvious reasons why.

I've noticed under IIS7.5 that every single page request re-issues the requests for the js libraries - the first one a 401, followed by either a 200 (OK) or 304 (not modified), as opposed to the above log extract where that only happened during the 1st request.

Is there any way to eliminate the 401 requests? Could a timing issue have something to do with the click being ignored? Would increasing the number of concurrent connections help? Any other ideas? I'm at a bit of a loss to explain this.

I hope I'm not totally off-base here, but your scripts may not be getting requested the second time because they are already cached by your browser, and it does not feel it needs to re-request them.

Secondly, and this isn't an answer per se, but may help you troubleshoot this, is to take a look at the "Net" tab in the Firebug extension for Firefox and see if anything is appearing in red where the scripts are loading. This would indicate that a script has failed to retrieve properly. (Weird about those 401's you're getting. This may be part of the problem, but my suggestion here would let you know if it's responsible for the whole problem or just part of it.) It would also let you know specifically what error is occurring when you click the checkbox. This would hopefully make this more "obvious" whey the click sometimes fails, if you see the Bug turn red. (And what, specifically, has failed.)

Best of luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM