gpt4 book ai didi

c# - 如何检查 Request.QueryString 在 ASP.NET 中是否具有特定值?

转载 作者:IT王子 更新时间:2023-10-29 03:42:42 25 4
gpt4 key购买 nike

我有一个 error.aspx 页面。如果用户访问该页面,它将使用 Request.QueryString["aspxerrorpath"]page_load() 方法 URL 中获取错误路径,它工作正常。

但是如果用户直接访问该页面,它将产生异常,因为 aspxerrorpath 不存在。

如何检查 aspxerrorpath 是否存在?

最佳答案

您可以只检查null:

if(Request.QueryString["aspxerrorpath"]!=null)
{
//your code that depends on aspxerrorpath here
}

关于c# - 如何检查 Request.QueryString 在 ASP.NET 中是否具有特定值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8678471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com