【问题标题】:Determine if default.aspx is in the address bar确定 default.aspx 是否在地址栏中
【发布时间】:2012-07-14 20:31:26
【问题描述】:

在我的网络配置文件中,我将主页设置为

<location path="Default.aspx">
    <system.web>
        <httpRuntime requestValidationMode="2.0" />
    </system.web>
</location>

这是为了允许将 HTML 输入到我的表单中。但是,它不适用于mywebsite.com/。它确实适用于mywebsite.com.default.aspx

所以我要么需要知道如何使它适用于mywebsite.com/,要么我需要一种方法来确定default.aspx 是否在地址栏中。由于某种原因,我找不到不会告诉我default.aspx 的服务器变量,即使它不在地址栏中。

【问题讨论】:

    标签: asp.net vb.net web-config response.redirect


    【解决方案1】:

    对于 IIS 7,像这样设置默认文档:

    <configuration>
       <system.webServer>
          <defaultDocument enabled="true">
             <files>
                <add value="Default.aspx" />
             </files>
          </defaultDocument>
       </system.webServer>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 2011-02-05
      • 2016-05-24
      • 2011-08-21
      • 1970-01-01
      • 2010-10-16
      • 2013-06-28
      • 1970-01-01
      • 2013-10-23
      • 1970-01-01
      相关资源
      最近更新 更多