Type of Request Web Client
As identified in C # where this is requested a specific web page, I wonder if the request comes from an image <img src="http://www.mydomain.com/default.aspx?n=123" />
or if the request is directly through an http browser, for example when the client is actually accessing the page via a browser sampl开发者_运维百科e: http://www.mydomain.com/default.aspx?n=123
See Finding the referring url that brought a user to my site.
You'll probably get more answers if you tag your question with ASP.NET.
No, it's not completely reliable. HTTP is in large part a cooperative protocol. That is, there are fields there that browsers can use to identify themselves and tell you where they're coming from, but nothing forces them to do it. The sad truth, unbelievable as it may seem, is that people might lie to you. They might say they're viewing your image from your Web page, when they really aren't. Or their browser might not tell you that it's viewing the image from your Web page. In general, the UrlReferrer
thing works, but it can be defeated. Just as the browser identification string can be spoofed. We do the best that we can, and call it good enough.
I would expect the Request.UrlReferrer
to be null
when the image src makes the request.
精彩评论