Asp.net 如何使用Web.config将defaul.aspx重定向到另一个页面(例如mynew.aspx)

Asp.net 如何使用Web.config将defaul.aspx重定向到另一个页面(例如mynew.aspx),asp.net,Asp.net,如何使用Web.config将defaul.aspx重定向到另一个页面(例如mynew.aspx)?我在MSVisualStudio2010(C#)中写下了我的网站: <system.webServer> <defaultDocument> <files> <clear \> <add value = "mynewdefault.aspx" /> </files> 然后像正常一样关闭所有其他内容

如何使用Web.config将defaul.aspx重定向到另一个页面(例如mynew.aspx)?我在MSVisualStudio2010(C#)中写下了我的网站

<system.webServer>
 <defaultDocument>
  <files>
   <clear \>
    <add value = "mynewdefault.aspx" />
  </files>


然后像正常一样关闭所有其他内容。

如果您使用的是身份验证,则
defaultUrl
属性可以作为解决方案

<authentication mode="Forms">
  <forms loginUrl="~/Login.aspx" timeout="2880"  defaultUrl="~/Welcome.aspx" />
</authentication>


您的新默认页面是
Welcome.aspx
now.

在您的情况下,您应该使用其他答案中建议的默认文档。但是,如果有人需要使用httpRedirect模块重定向单个页面,这里是他们应该使用的配置

<system.webServer>
  <httpRedirect enabled="true" exactDestination="true" childOnly="true" destination="">
    <clear/>
    <add wildcard="/Default.aspx" destination="MyNew.aspx" />
  </httpRedirect>
</system.webServer>


是否要更改默认页面?或者只是想重定向?我想更改默认页面。不是我写的你写的。让我解释一下:我在不同的文件夹中有几个default.aspx文件。当我在地址栏中写下“www.mywebsite.com”时,我想看到~web/default.aspx。现在,当我写www.mywebsite.com时,没有显示任何内容。但当我手动编写时,www.mywebsite.com/web/default.aspx就会加载有用的页面。我希望它能自动执行,但如何执行?如果您在Windows Server上部署了项目,则需要从Internet信息服务打开web应用程序的属性。从那里,打开“文档”选项卡并添加新的默认页面。我编辑了IIS选项/文档图片的答案。我将文件上载到主机。我的网站现在是在线的。我总是使用我自己的服务器,所以我的答案可能是错误的:)。对于其他主机,应该有选择默认页面的选项。当我在我的web.config文件中写入上述内容时,是否写入了包含invaild子元素的内容?应在iis上安装httpRedirect模块。另外,这会以某种方式禁用VisualStudio2010的调试。这应该放在元素下。