C# 如何从URL中剪切“/Default.aspx”

C# 如何从URL中剪切“/Default.aspx”,c#,asp.net,asp.net-routing,C#,Asp.net,Asp.net Routing,路线是有效的,但当我开始我的网站,我得到了 localhost:57564/Default.aspx 是否有简单的修复方法?在web.config文件中使用重写规则 <configuration> <system.webServer> <rewrite> <rules> <rule name="Default Redirect" stopProcessing="true">

路线是有效的,但当我开始我的网站,我得到了

 localhost:57564/Default.aspx

是否有简单的修复方法?

在web.config文件中使用重写规则

<configuration>
   <system.webServer>
     <rewrite> 
    <rules>   
    <rule name="Default Redirect" stopProcessing="true">
            <match url="^Default\.aspx$" />
            <action type="Redirect" url="/" redirectType="Permanent" />
        </rule>
    </rules>
    </rewrite>
    </system.webServer>
</configuration>

你可以使用重写规则来做这件事。这件事的可能重复在网上已经被问了数千次了。你真的想找一分钟吗?人们一天比一天懒惰…这不起作用,因为我的网站不是在线的。这给了我一条erorr消息。你在IIS服务器中安装了重写规则吗?使用此链接下载我不确定的url-重写。添加了扩展名,但未更改任何内容。无法读取配置节“规则”,因为它缺少节声明。