ASP.NET HttpHandler 和 WebResource.axd 问题
我需要一个简单的 HttpHandler 来处理 ASP.NET 项目中特定的不存在路径。我正在使用 sitefinity 4。我编写了处理程序,但每当我尝试运行该网站时,都会收到令人沮丧的错误
The WebResource.axd handler must be registered in the configuration to process this request.
我将处理程序放在配置的 system.web 部分中,但看起来 VS2010 仍然使用 IIS 6,因为它是内置的 Web 服务器,所以我继续将其切换为使用 IIS 7(本地)并移动处理程序的注册到 system.webServer ,当我点击不存在的 url 时它会起作用,但如果我尝试正常访问该站点(有效的 url),我会再次收到该错误。
它曾经工作过一次,为我提供了有效网址上的正确网站,但现在它继续给我带来麻烦。
我该如何解决这个问题?我不想将该条目添加到配置中,因为当我创建项目时它不存在,并且它仅在我添加处理程序时才启动。
编辑:仅当我使用 Path="*" 时才会发生,那么如何使用通配符?我不想映射处理程序来捕获 404 页面。
I need a simple HttpHandler to handle specific non-existant paths in my ASP.NET project. I'm using sitefinity 4. I wrote the handler but whenever I try to run the site, I get a frustrating error
The WebResource.axd handler must be registered in the configuration to process this request.
I was putting the handler in the system.web part of the config but it looks liek VS2010 still uses IIS 6 for it's built in web server so I went ahead and switched it to use IIS 7 (local) and moved the registration of the handler to system.webServer and it works when I hit a non existant url but if I try to go to the site normally (valid url) I get that dang error again.
It worked once, giving me the correct site on a valid url but now it just continues to give me trouble.
How can I resolve this issue? I don't want to add that entry to the config as it wasn't there when I created the project and it only started when I added my handler.
EDIT: Only happens when I use Path="*" so how do I do a wildcard? I don't want to map a handler to catch a 404 page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
忘记它吧。似乎没有人知道,尽管我知道我不是唯一需要这样做的人。我得到了 404 的工作,但只有当我请求一个文件,而不是一个文件夹时,所以那就是半身像。
我发现 Global.asax 会在集成模式下运行,所以我只是将代码移至 Application_BeginRequest() 并且它工作得很好。如果其他人有更好的答案,我会给予他们信任。
Froget it. No one seems to know even though I know i'm not the only one who has needed to do this. I got 404 to work but ONLY when I request a file, not a folder so thats a bust.
I found that Global.asax will hit under integrated mode so I just moved my code to the Application_BeginRequest() and it's working just fine. If anyone else has a better answer I will give them credit.
对于iis7和iis7.5,处理程序在system.webserver中注册。 system.web 中的 httphandlers 和 httpmodules 被忽略并用于 IIS 6 和经典模式。
我希望这有帮助!
for iis7 and iis7.5, handlers are registered in system.webserver. the httphandlers and httpmodules in system.web are ignored and are used for IIS 6 and classic mode.
i hope this was helpful!