Asp.net IIS自动将网站中选定应用程序的http重定向到https
我在IIS中设置了一个网站,该网站有两个应用程序(如下面的快照所示) 我必须在应用程序上启用https。我已经安装了SSL证书,并将应用程序设置为使用https而不是http。现在我想实现从http到https的自动编辑,只针对测试应用程序(PersonalCornerTest)。 我使用以下链接作为参考,使用URLEWRITE (方法1) 和 (方法1) 我在测试应用程序的配置文件中使用了以下设置Asp.net IIS自动将网站中选定应用程序的http重定向到https,asp.net,redirect,iis,iis-7,iis-7.5,Asp.net,Redirect,Iis,Iis 7,Iis 7.5,我在IIS中设置了一个网站,该网站有两个应用程序(如下面的快照所示) 我必须在应用程序上启用https。我已经安装了SSL证书,并将应用程序设置为使用https而不是http。现在我想实现从http到https的自动编辑,只针对测试应用程序(PersonalCornerTest)。 我使用以下链接作为参考,使用URLEWRITE (方法1) 和 (方法1) 我在测试应用程序的配置文件中使用了以下设置 <rule name="HTTP to HTTPS redirect" stopPro
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
然而,问题是,在添加以下代码后,当用户尝试在url中使用http访问测试站点时,它会自动重定向到https,但会重定向到非测试站点(即PersonalCorner),而不是测试应用程序,这令人困惑
有人能告诉我在上述设置中我犯了什么错误吗?我只想为测试应用程序实现autoredirect。自己回答我的问题 下面的配置修复了该问题
<rewrite>
<rules>
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
URL的格式是什么?您的测试和非测试网站的url?您是否在测试应用程序的web.config中添加了此规则?url格式为(对于非测试)和(对于测试网站)。因此,当我键入automatically redirects to(非测试)时,我只将规则添加到test应用程序的web.config中。有什么建议吗?