Asp.net mvc ASP.NET MVC将非WWW重定向到WWW并重写为小写URL

Asp.net mvc ASP.NET MVC将非WWW重定向到WWW并重写为小写URL,asp.net-mvc,redirect,iis-7,Asp.net Mvc,Redirect,Iis 7,我正在尝试使用web.config来实现这一点,当我有一个default.aspx文件时,它工作得很好,但我使用的是MVC,没有root.aspx文件。如何让它进入我的主控制器,然后进入索引视图 <system.webServer> <rewrite> <rules> <rule name="Redirect to WWW" stopProcessing="true"> <match url=".*" />

我正在尝试使用web.config来实现这一点,当我有一个default.aspx文件时,它工作得很好,但我使用的是MVC,没有root.aspx文件。如何让它进入我的主控制器,然后进入索引视图

<system.webServer>
<rewrite>
  <rules>
    <rule name="Redirect to WWW" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^mydomain.com$" />
      </conditions>
      <action type="Redirect" url="http://www.mydomain.com/{R:0}"
           redirectType="Permanent" />
    </rule>
    <rule name="convert to lower case" stopProcessing="false"> 
<match url=".*[A-Z].*" ignoreCase="false"/> 
<conditions> 
<!-- The following condition prevents rule from rewriting requests to .axd files --> 
<add input="{URL}" negate="true" pattern="\.axd$"/> 
</conditions> 
<action type="Redirect" url="{toLower:{R:0}}" redirectType="Permanent"/> 
</rule>
      </rules>
    </rewrite>
    <directoryBrowse enabled="false" />
    </system.webServer>


它告诉我它不能列出目录的内容,但无论如何它都不应该这样做。

你看到这篇文章了吗?

你看到这篇文章了吗?

我刚才看到了,这和我在上面看到的差不多。我重新发布了它,现在它工作了。。。想想看,我会把这个作为答案,因为这里还有一些对我有用的东西。谢谢你。我刚做了,和上面的差不多。我重新发布了它,现在它工作了。。。想想看,我会把这个作为答案,因为这里还有一些对我有用的东西。谢谢你。