1

我想将所有传入流量从 重定向http://www.example.comhttp://www.mysite.com/badreferer.aspx?bad=true

我正在研究 IIS7 和 asp.net 4.0 和 c#。

有什么办法可以在 IIS7 中进行配置?

<rule name="bad referer" stopProcessing="true">
  <match url="(.*)" />
  <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_REFERER}" pattern="(.*)example.com(.*)" /> 
    <add input="{HTTP_REFERER}" pattern="(.*)example2.com(.*)" />                        
  </conditions>
  <action type="Redirect" url="/badreferer.aspx?bad=true" appendQueryString="false" />          
</rule>

此规则会产生错误The webpage at http://www.mysite.com/badreferer.aspx?bad=true has resulted in too many redirects

4

1 回答 1

0

您可以为此使用 Response.PermanentRedirect。欲了解更多信息,请通过以下链接。

http://msdn.microsoft.com/en-us/library/system.web.httpresponse.redirectpermanent.aspx

于 2013-05-29T18:33:51.323 回答