如何找出iis7中404error handling程序中缺少哪条请求路径?

我想在iis 7中创建一个自定义error handling程序。

web.config httpErrors部分:

    

web.config httpHandler来处理错误:

  

Image404Handler c#代码:

 public void ProcessRequest(HttpContext context) { string requestpath; if (context.Request.QueryString.AllKeys.Contains("aspxerrorpath")) { requestpath = context.Request.QueryString["aspxerrorpath"]; } else { requestpath = context.Request.Path; } // more code not really relevant here } 

我无法弄清楚如何获取导致404错误触发的请求的路径。 在IIS 6中,Visual Studio 2008使用此路径将添加到查询字符串中的aspxerrorpath。

我无法进行远程调试工作,所以我在这里询问是否有人知道该怎么做。

我自己找到了答案。

使用HttpСontext.Request.RawUrl而不是HttpСontext.Request.Path