windows WebResource.axd 使用 IIS7 在 ASP.Net Post 中给出 403 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/123585/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:17:43  来源:igfitidea点击:

WebResource.axd giving 403 error in ASP.Net Post backs using IIS7

windowsiis-7windows-server-2008webresource.axd

提问by user2013

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.axdin the address bar), I get a HTTP 403 error (Access Denied).

我在 Windows 2008 服务器上安装了一个 ASP.Net 网站,默认情况下使用 IIS7。该网站似乎工作正常,但我的表格上的回帖不起作用。经过几个小时的调试,我意识到当我手动尝试在浏览器中点击 WebResource.axd 文件时(例如,我在地址栏中输入http://www.domain.com/WebResource.axd),我得到一个HTTP 403 错误(拒绝访问)。

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?

我不太确定下一步该往哪里看,而且我的 Windows 2008 安全知识有限。我如何去授予对该文件的访问权限?

回答by Enes

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:

导航到您的 iis 配置文件夹。通常:c:\windows\system32\inetsrv\config 并打开 applicationHost.config 文件。然后在文件中导航到该<handlers>部分并检查是否存在以下行:

<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.

也就是说,如果您在集成模式下运行。检查是否指定了动词 GET。

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 addsection in your web.config file respecting the order in of the handlers/modules specified in applicationHosting.config file.

如果一切似乎都没有问题,请查看处理程序和模块部分中的 web.config,看看您是否已添加<clear />到每个的顶部。如果你这样做了,那么你已经在 web.config 文件中包含add部分,尊重 applicationHosting.config 文件中指定的处理程序/模块的顺序。

回答by Turnkey

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?

检查您的 IIS 日志 - 他们应该提供一个状态代码,其中包含有关错误的更多详细信息。另外,回发错误的性质是什么?

回答by user2013

This is the error that I'm getting when doing a Postback:

这是我在执行回发时遇到的错误:

WebForm_PostBackOptions is undefined.

WebForm_PostBackOptions 未定义。

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...

据我所知,该函数包含在 WebResource.axd 文件中,这让我在地址栏中尝试了它,我是如何知道 403 错误的...

回答by Turnkey

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.

不确定那个,但它可能与 IIS 中的 http 压缩有关。还要检查该文件是否可供 IIS 用户访问。

回答by user13020134

There is a issue in Firewall setting. Request is blocked in Firewall. contact server admin to change configuration. We got solution.

防火墙设置有问题。请求在防火墙中被阻止。联系服务器管理员更改配置。我们得到了解决方案。