如何检查的Request.QueryString还没有在ASP.NET中的特定值或? [英] How to check that Request.QueryString has a specific value or not in ASP.NET?
本文介绍了如何检查的Request.QueryString还没有在ASP.NET中的特定值或?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 error.aspx
页。如果用户涉及到该网页,然后将获取的的Page_Load错误路径()
使用方法网址的Request.QueryString [aspxerrorpath]
并能正常工作。
I have an error.aspx
page. If a user comes to that page then it will fetch the error path in page_load()
method URL using Request.QueryString["aspxerrorpath"]
and it works fine.
但是,如果用户直接访问该网页就会产生一个异常,因为 aspxerrorpath
是不存在的。
But if a user directly accesses that page the it will generate an exception because aspxerrorpath
is not there.
我如何检查 aspxerrorpath
有或没有?
推荐答案
您可以只检查空
:
if(Request.QueryString["aspxerrorpath"]!=null)
{
//your code that depends on aspxerrorpath here
}
这篇关于如何检查的Request.QueryString还没有在ASP.NET中的特定值或?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文