问题
I installed a ASP.Net website on a Windows 2008 server, which is by default using IIS7. The website seems to work fine, but the post backs on my forms do not work. After a few hours of debugging, I realized that when I manually try to hit the WebResource.axd file in my browser (e.g. I type http://www.domain.com/WebResource.axd in the address bar), I get a HTTP 403 error (Access Denied).
I'm not quite sure where to look next and my Windows 2008 security knowledge is limited. How do I go about giving access to that file?
回答1:
Navigate to your iis config folder. Typically: c:\windows\system32\inetsrv\config
and open applicationHost.config file. Then within file navigate to the <handlers>
section and check that following line is present:
<add name="AssemblyResourceLoader-Integrated" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode" />
That is if you're running in integrated mode. Check that verb GET is specified.
If you are running in classic pipeline mode that this line should be present
<add name="AXD-ISAPI-2.0" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
If everything seems to be ok than look at your web.config in Handlers and Modules section and see if you have added <clear />
on the top of each. If you did then you have include add section in your web.config file respecting the order in of the handlers/modules specified in applicationHosting.config file.
回答2:
Check your IIS logs - they should give a status code that has more detailed information about the error. Also, what is the nature of the error on the postback?
回答3:
This is the error that I'm getting when doing a Postback:
WebForm_PostBackOptions is undefined.
To my knowledge that function is contained inside the WebResource.axd file, which led me to try it in the address bar, which how I know about the 403 error...
回答4:
Not sure on that one, but it may be related to http compression in IIS. Also check that the file is accessible to the IIS User.
来源:https://stackoverflow.com/questions/123585/webresource-axd-giving-403-error-in-asp-net-post-backs-using-iis7