我该如何查找出现错误404的带有QueryString的地址 [英] How can i find Address With QueryString that made Error 404

查看:52
本文介绍了我该如何查找出现错误404的带有QueryString的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我在项目中创建了一个电子页面,然后将404错误重定向到该页面.
在此页面中,我有一个页面在我的项目中不存在,但我也需要querystring.

例如,如果此地址出错:
www.mydomain.com/article.aspx?articleID=101

如果我的错误页面是:
www.mydomain.com/error.aspx

所以在处理错误后我有这个:

www.mydomain.com/error.aspx?aspxerrorpath=/article.aspx


有什么办法可以找到查询字符串(

Hi every one.

I made e page in my project and redirect 404 error to that page.
in this page i have a page that no exists in my project but i need querystring too.

for example if this address made error :
www.mydomain.com/article.aspx?articleID=101

And if my error page is :
www.mydomain.com/error.aspx

so i have this after handle error :

www.mydomain.com/error.aspx?aspxerrorpath=/article.aspx


is there any way that i can find querystring (

?articleID=101

)

在此先感谢您.

)

Thanks in advance.

推荐答案

,您可以将global.asax文件添加到您的项目中,并在您的application_error方法中添加以下内容:
you can add a global.asax file to your project, and in your application_error method put this:
protected void Application_Error(object sender, EventArgs e)
  {
      string url = Request.QueryString[0];
      Response.Redirect("/error.aspx?querystring=" + url);
  }


这不是很好,因为此方法适用于根应用程序中的所有错误,因此您应该处理并自定义,您可以使用ELMAH来跟踪错误!


this is not good because this method is for all errors in your root application and you should handle this and customize, you can use ELMAH for tracking error!


转到web.config并检查


Go to web.config and check


<customerror> 
....
//you will find the redirect url here
</customerror>



如果找到答案,请回答,不要忘了给
评分

谢谢,

灰烬



make it answer if you find your answer, dont forget to rate


Thanks,

Ashish


这篇关于我该如何查找出现错误404的带有QueryString的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆