Request.UrlReferrer.ToString() - GT; System.NullReferenceException:对象不设置到对象的实例 [英] Request.UrlReferrer.ToString() ->System.NullReferenceException: Object reference not set to an instance of an object
本文介绍了Request.UrlReferrer.ToString() - GT; System.NullReferenceException:对象不设置到对象的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试 Request.UrlReferrer.ToString()
此错误occures:
System.NullReferenceException:对象不设置到对象的实例
块引用>解决方案您必须检查
UrlReferrer
为空,因为它并不总是设置(例如,当有人输入该URL直接到地址栏,或在书签点击)...(Request.UrlReferrer == NULL)? :Request.UrlReferrer.ToString()
When I try
Request.UrlReferrer.ToString()
this error occures:System.NullReferenceException: Object reference not set to an instance of an object
解决方案You have to check if
UrlReferrer
is null, as it's not always set (ie, when someone typed the URL directly into the address bar, or clicked on a bookmark)...(Request.UrlReferrer == null) ? "" : Request.UrlReferrer.ToString()
这篇关于Request.UrlReferrer.ToString() - GT; System.NullReferenceException:对象不设置到对象的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文