62,040
社区成员
发帖
与我相关
我的任务
分享
if (Request.HttpMethod.Equals("POST") || Request.HttpMethod.Equals("GET"))
{
string HTTP_REFERER = Request.ServerVariables["HTTP_REFERER"].ToString();
if (HTTP_REFERER != "" && HTTP_REFERER != null)
{
HTTP_REFERER = HTTP_REFERER.Substring(HTTP_REFERER.IndexOf(@"//") + 2);
HTTP_REFERER = HTTP_REFERER.Substring(0, HTTP_REFERER.IndexOf(@"/"));
}
if (HTTP_REFERER != Request.ServerVariables["HTTP_HOST"].ToString())
{
Server.Transfer("Error.aspx");
}
}
if (Request.ServerVariables["HTTP_REFERER"] == null || !Request.ServerVariables["HTTP_REFERER"].ToString().Contains(Request.ServerVariables["HTTP_HOST"].ToString()))
{
Server.Transfer("Error.aspx");
}