如何使用Web.config将default.aspx重定向到另一个页面(对于new.aspx)?我在MS Visual Studio 2010(C#)中编写了我的网站
答案 0 :(得分:2)
下:
<system.webServer>
<defaultDocument>
<files>
<clear \>
<add value = "mynewdefault.aspx" />
</files>
并关闭其他一切正常。
答案 1 :(得分:0)
如果您使用身份验证,那么defaultUrl
属性可以是解决方案。
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" timeout="2880" defaultUrl="~/Welcome.aspx" />
</authentication>
您的新默认页面现在为Welcome.aspx
。
答案 2 :(得分:0)
在您的情况下,您应该使用其他答案中建议的默认文档。如果有人需要使用httpRedirect模块重定向单个页面,那么他们应该使用的配置。
<system.webServer>
<httpRedirect enabled="true" exactDestination="true" childOnly="true" destination="">
<clear/>
<add wildcard="/Default.aspx" destination="MyNew.aspx" />
</httpRedirect>
</system.webServer>