将来自www.example.com的所有流量重定向到IIS7中的特定页面

本文关键字:IIS7 重定向 流量 www example com 将来 | 更新日期: 2023-09-27 18:16:01

我想将所有传入流量从http://www.example.com重定向到CCD_ 2。

我正在研究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

将来自www.example.com的所有流量重定向到IIS7中的特定页面

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

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