longpan 发表于 2015-8-16 11:21:04

IIS泛解析排除无关域名的办法

  IIS启用泛解析后,要是某个IP指向该服务器,该服务器就会被识别为绑定了改域名,要是该是没有备案的那么服务器就有麻烦了。其实我们可以实行白名单制度,对制定域名实行处理,其他域名避开,浏览器返回 http 400就行。 如下是解决办法:
  如:服务器只让 ynshangji.com 和 zhaoshang100.com 连接,那么我们可以这样设置:
  <%
if instr(Request.ServerVariables("HTTP_HOST"),"ynshangji.com")=0and instr(Request.ServerVariables("HTTP_HOST"),"zhaoshang100.com")=0 then
Response.Status="400 Bad Request"
Response.End
end if
%>
  
  


if (Request.ServerVariables["Http_Host"].Trim().IndexOf("91qiye.com") == -1)//非91qiye.com
      {
            Response.Status = "400 Bad Request";
            Response.End();
      }
      else  
      { Response.Write("sd"); }  
页: [1]
查看完整版本: IIS泛解析排除无关域名的办法