ASP.NET Request.UrlReferrer 问题

ASP.NET Request.UrlReferrer 作用:

官网解释:Gets information about the URL of the client's previous request that linked to the current URL.

获取 到达当前页面之前的URL信息

此Request.UrlReferrer 容易为null, 当第一次打开当前页面 或者 在浏览器地址栏中按 Enter/回车键 时, 都会为null。 使用时需验证为null情况,以防出错。

 

PS:

Request.Url : 获取 当前URL的全路径 , 举例:http://localhost:16867/Guestbook/Write

Request.RawUrl : 获取当前url的 文件路径部分 , 举例: /Guestbook/Write

 

posted @ 2016-11-04 14:06  jason_LSZ  阅读(528)  评论(0编辑  收藏  举报