How to set start page in Web.config file in asp.net c#(如何在ASP.NET C#中设置Web.config文件中的起始页)
问题描述
如何使用Web.config
文件设置起始页。我已尝试过此代码
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear />
<add value="index.aspx"/>
</files>
</defaultDocument>
</system.webServer>
但它对我不起作用。我已通过在解决方案资源管理器中右键单击页面来设置起始页,然后选择选项设置为起始页,但如何以编程方式执行此操作?
推荐答案
以下代码对我来说运行良好。请检查您的Web.config
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Login.aspx"/>
</files>
</defaultDocument>
</system.webServer>
这篇关于如何在ASP.NET C#中设置Web.config文件中的起始页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!