HttpContext.Current.Request.ServerVariables [" HTTP_REFERER"]空 [英] HttpContext.Current.Request.ServerVariables["HTTP_REFERER"] null

查看:447
本文介绍了HttpContext.Current.Request.ServerVariables [" HTTP_REFERER"]空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用以下code来获得在Global.asax中的session_start参考网址:

I am trying to use following code to get referring url in global.asax session_start:

HttpContext.Current.Request.ServerVariables["HTTP_REFERER"]

我试着用 Request.UrlReferrer.AbsoluteUri但UrlReferrer 也为空。

但我得到空。能否请你建议我什么是错的或替代?

but I am getting null. Can you please suggest me what is wrong or alternative?

推荐答案

并非所有的用户代理的发送的引荐,一些代理/中介机构的的引荐,常有简单的引用不

Not all user-agents send a referrer, some proxies/intermediaries strip the referrer, and often there simply is no referrer.

只是检查是否 Request.UrlReferrer == NULL 在某一点;如果是,不要试图在看 Request.UrlReferrer.AbsoluteUri

Just check whether Request.UrlReferrer == null at some point; if it is, don't try looking at Request.UrlReferrer.AbsoluteUri.

有什么错在这里,没有什么可以做的。如果你不知道他们来自哪里,你就得忍受这一点。

There is nothing "wrong" here, and nothing you can do about it. If you don't know where they came from, you'll just have to live with that.

这篇关于HttpContext.Current.Request.ServerVariables [" HTTP_REFERER"]空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆