Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Anti-outside chain in referer

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to achieve anti-chain referer, Xiaobian think it is quite practical, so share it for everyone to make a reference, I hope you can gain something after reading this article.

HTTPReferer is part of the header. When a browser sends a request to a web server, it usually carries a Referer, telling the server which page the page is linked from, so the server can obtain some information for processing.

Referer Profile

Link from my homepage to a friend, and his server will be able to count from HTTP Referer how many users click on my homepage link to visit his website each day.

The correct English spelling of Referer is Referrer. Because of spelling errors in the early HTTP specification, it was a mistake to preserve backward compatibility. Other network technology specifications attempt to correct this problem by using the correct spelling, so spelling is not uniform.

Request.ServerVariables("HTTP_REFER") is used to prevent external connections. [1]

referrer anti-chain code

In C#:

if(Request.ServerVariables["HTTP_REFERER"]==null||! Request.ServerVariables["HTTP_REFERER"].ToString().Contains(Request.ServerVariables["HTTP_HOST"].ToString()))

{

Server.Transfer("Error.aspx");

}

ServerVariables("HTTP_REFER") is normally obtained from the browser's address bar:

directly with

Submit or submit forms (POST or GET)

Forms submitted using JavaScript (POST or GET)

Request.ServerVariables("HTTP_REFER") cannot be taken normally:

Links from Favorites

Click Home or Custom Address

Enter the address directly into the browser

Use JavaScript Location.href or Location.replace()

Or turn.

Loading addresses with XML

Obviously, Request.ServerVariables("HTTP_REFER") doesn't work properly in most cases.

About the "referer how to achieve anti-chain" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report