C# 在 Web.Config 中为网站设置默认 URL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/772084/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Setting Default URL in Web.Config for website
提问by
When users navigate to my site, I want it to display :
当用户导航到我的网站时,我希望它显示:
http://example.com
and not:
并不是:
http://example.com/default.aspx
How can I do that?
我怎样才能做到这一点?
回答by Dimi Takis
Either you set the default page in your IIS or inside your solution explorer by right-clicking and selecting "Set as start page".
您可以通过右键单击并选择“设置为起始页”在 IIS 或解决方案资源管理器中设置默认页面。
回答by Mladen Mihajlovic
回答by annakata
回答by Leonid Shirmanov
If you run your web site under IIS just launch IIS manager in Windows, then open your site in a tree and double click on Default documents icon. In opened window make sure that index.aspx setting exists, if doesn't put it in and move it up to the first one in a list.
如果您在 IIS 下运行您的网站,只需在 Windows 中启动 IIS 管理器,然后在树中打开您的网站并双击默认文档图标。在打开的窗口中确保 index.aspx 设置存在,如果没有将其放入并将其移动到列表中的第一个。
Also there is a way to set up the default document via admin script (vbscript) like this:
还有一种方法可以通过管理脚本 (vbscript) 设置默认文档,如下所示:
set node=getObject("IIS://LocalHost/W3SVC/1/Root")
node.defaultdoc = "index.aspx" & "," & node.defaultdoc
node.setinfo
回答by Nabin Aryal
in IIS->your site->right click->property->Default Document
在 IIS->your site->right click->property->Default Document
Set the default page that you want to open on load
设置要在加载时打开的默认页面