开发者

Asp.net request.UrlReferrer is null

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜