现在的位置: 首页 > 综合 > 正文

关于是否来自站内连接的一段判断程序

2013年03月28日 ⁄ 综合 ⁄ 共 402字 ⁄ 字号 评论关闭

if(Request.ServerVariables["HTTP_REFERER"]!=null)
   {
    string HTTP_REFERER=Request.ServerVariables["HTTP_REFERER"].ToString().ToLower();
    string HTTP_HOST=Request.ServerVariables["HTTP_HOST"].ToString().ToLower();

    if(HTTP_HOST==HTTP_REFERER.Substring(7,HTTP_HOST.Length))
    {
     Response.Write("OK");
    }
    else
    {
     Response.Write("ERR");
    }
   }
   else
   {
    Response.Write("ERR");
   }

抱歉!评论已关闭.