开发者

Asp.net request.UrlReferrer is null

开发者 https://www.devze.com 2023-02-10 18:39 出处:网络
in my web appl开发者_如何学Pythonication Request.UrlReferrer is null. how can i set UrlReferrer ? You don\'t need to set the UrlReferrer. The referrrer is something that the browser sends to the serve

in my web appl开发者_如何学Pythonication Request.UrlReferrer is null. how can i set UrlReferrer ?


You don't need to set the UrlReferrer. The referrrer is something that the browser sends to the server. This property is how you read what the browser sent as a referrer. For obvious reasons you cannot set what the browser sends you because your server does not control it.

Why do you want to set it anyway?


you want to make sure UrlReferrer is not null. if you do not it can create 'Object reference not set to an instance of an object.' error.

if (!(Request.UrlReferrer == null)) {
    'if Request.UrlReferrer is not null do this 
}
else {
    'set Request.UrlReferrer to null
}
0

精彩评论

暂无评论...
验证码 换一张
取 消