Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我尝试Request.UrlReferrer.ToString()出现此错误时:
Request.UrlReferrer.ToString()
System.NullReferenceException:对象引用未设置为对象的实例
您必须检查是否UrlReferrer为空,因为它并不总是设置(即,当有人直接在地址栏中键入 URL 或单击书签时)...
UrlReferrer
(Request.UrlReferrer == null) ? "" : Request.UrlReferrer.ToString()