何时使用Request.UrlReferrer和Request.ServerVariables [“HTTP_REFERER”]?

时间:2022-09-28 02:06:46

Both returns the incoming url, Just to know When to use Request.UrlReferrer and when Request.ServerVariables["HTTP_REFERER"] and why?

两者都返回传入的URL,只知道何时使用Request.UrlReferrer和Request.ServerVariables [“HTTP_REFERER”]以及为什么?

Currently, in one of my application Urlreferrer is working in my local machine but its not working when went live?

目前,在我的一个应用程序中,Urlreferrer正在我的本地计算机上工作,但它在上线时无法正常工作?

Additionally, its most appreciable if anyone can guide any alternative of both Urlreferrer and HTTP_REFERRER?

此外,如果有人可以指导Urlreferrer和HTTP_REFERRER的任何替代方案,那么最明显的是什么?

2 个解决方案

#1


5  

Answering to last question. Request.UrlReferrer returns an Uri object, so if UrlReferrer has bad format then you get an exception. It seems strange, but some times I have got it. HTTP_REFERER is a string.

回答最后一个问题。 Request.UrlReferrer返回一个Uri对象,因此如果UrlReferrer格式错误,则会出现异常。这看起来很奇怪,但有时我得到了它。 HTTP_REFERER是一个字符串。

#2


0  

Does the Request.ServerVariables[] work in the live situation? It is my understanding that the two are identical.

Request.ServerVariables []是否在实时情况下工作?我的理解是两者是相同的。

Can it be that proxies and/or firewalls (at the server, the client or anywhere inbetween as an ISP) are stripping the referrer?

代理和/或防火墙(在服务器,客户端或ISP之间的任何地方)是否正在剥离引用者?

#1


5  

Answering to last question. Request.UrlReferrer returns an Uri object, so if UrlReferrer has bad format then you get an exception. It seems strange, but some times I have got it. HTTP_REFERER is a string.

回答最后一个问题。 Request.UrlReferrer返回一个Uri对象,因此如果UrlReferrer格式错误,则会出现异常。这看起来很奇怪,但有时我得到了它。 HTTP_REFERER是一个字符串。

#2


0  

Does the Request.ServerVariables[] work in the live situation? It is my understanding that the two are identical.

Request.ServerVariables []是否在实时情况下工作?我的理解是两者是相同的。

Can it be that proxies and/or firewalls (at the server, the client or anywhere inbetween as an ISP) are stripping the referrer?

代理和/或防火墙(在服务器,客户端或ISP之间的任何地方)是否正在剥离引用者?