本文介绍了Request.UrlReferrer.ToString() - GT; System.NullReferenceException:对象不设置到对象的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试 Request.UrlReferrer.ToString()此错误occures:

解决方案

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:对象不设置到对象的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 02:04