【问题标题】:ASP.NET Start Page loads always the Master PageASP.NET 起始页始终加载母版页
【发布时间】:2014-02-10 18:11:05
【问题描述】:

独立于我的网络应用程序起始页,它始终是 MasterPage。我有一个大多数页面都继承的 Masterpage,但我也有一个“Entrada.aspx”作为登录页面,它不继承 Masterpage。我希望“Entrada.aspx”是默认页面,但我无法将其设置为任何方式。

这是标题:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Entrada.aspx.cs" Inherits="webapp.Entrada" %>

我已在 webapp Visual Web Properties -> Start Action 中将 Entrada.aspx 设置为起始页

Specific Page: Entrada.aspx

我也在 web.config 中设置了:

<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument enabled="true">
  <files>
    <clear/>
    <add value="Entrada.aspx"/>
  </files>
</defaultDocument>

而且也不行。

我已经在 Visual Web 上下文菜单“设置为起始页”中设置了它,它也不起作用。

【问题讨论】:

  • 在调试模式下或发布后不进入 Entrada.aspx?
  • 这可能看起来微不足道,但是您是否尝试过更改您的 &lt;clear/&gt; 语句以在右括号前包含一个空格,例如&lt;clear /&gt;.
  • @nima 如果我运行调试它会转到localhost:59852/Entrada.aspx,但如果我直接从浏览器转到localhost:59852 它会首先加载 MasterPage
  • @Mendicant 我已经做到了。没用 谢谢

标签: c# asp.net visual-studio master-pages


【解决方案1】:

您使用的是 Visual Studio 开发服务器,您无需前往 localhost:59852 进行调试。只需让地址为 localhost:59852/Entrada.aspx。
但是在您使用 IIS 的生产服务器中,它可以工作。

【讨论】:

  • 我要去 localhost:59852,以测试在发送到我的网络服务器时是否在转到 domain.com/ 时重定向到 Entrada.aspx。但它在 VS Development Server 中的行为方式不同。我已将它发送到网络服务器,它实际上按预期工作。谢谢!
猜你喜欢
  • 1970-01-01
  • 2014-07-13
  • 2015-06-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多