真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