读书人

真TMD F了这也出有关问题 高手帮忙

发布时间: 2012-02-01 16:58:19 作者: rapoo

真TMD F了,这也出问题 高手帮忙 谢谢了 ,,
if (Request.ServerVariables[ "HTTP_REFERER "].IndexOf( "master ") > 0)
{

}
else
{

}

提示我这个
未将对象引用设置到对象的实例


真TMDF了 期待高手



[解决办法]
Request.ServerVariables[ "HTTP_REFERER "]的值为null
[解决办法]
Request.ServerVariables[ "HTTP_REFERER "] is null
try
if( Request.Referer != null && Request.Referer != String.Empty)
[解决办法]
Request.ServerVariables[ "HTTP_REFERER "]的值为null
为空才会出现这情况


Request.ServerVariables[ "HTTP_REFERER "] is null
try
{
if (Request.ServerVariables[ "HTTP_REFERER "].IndexOf( "master ") > 0)
{

}
else
{

}
}

or


if(Request.ServerVariables[ "HTTP_REFERER "] != null)
{
if (Request.ServerVariables[ "HTTP_REFERER "].IndexOf( "master ") > 0)
{

}
else
{

}
}
[解决办法]
if( Request.Referer != null && Request.Referer != String.Empty)
[解决办法]
与Request.Form或QueryString一个道理,都有可能为null
[解决办法]
(Request.ServerVariables[ "HTTP_REFERER "] isNULL
[解决办法]
不想判断可以这样写


if (Convert.ToString(Request.ServerVariables[ "HTTP_REFERER "]).IndexOf( "master ") > 0)
[解决办法]
Request.ServerVariables[ "HTTP_REFERER "]的值为null

读书人网 >asp.net

热点推荐