【问题标题】:Navigation to a route via Hyperlink通过超链接导航到路线
【发布时间】:2013-05-13 11:07:23
【问题描述】:

我在母版页中有一个超链接

<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false"  >
    <AnonymousTemplate>
           <%--[ <a href="~/Account/Login"  id="HeadLoginStatus" runat="server">Log In</a> ]--%>
           [ <asp:HyperLink ID="LoginHyperLink" NavigateUrl="~/Account/Login" runat="server" >Login</asp:HyperLink> ]
    </AnonymousTemplate>
    <LoggedInTemplate>
         Welcome <span class="bold"><asp:LoginName id="HeadLoginName" runat="server" /></span>!
         [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutText="Log Out" LogoutPageUrl="~/Account/Login"   /> ]
    </LoggedInTemplate>
</asp:LoginView>

点击此超链接后,我期待一个干净的 URL,但我得到了:

http://localhost:25458/Account/Login.aspx?ReturnUrl=%2fAccount%2fLogin

我已经定义了:

Routes.MapPageRoute("Login", "Account/Login", "~/Account/Login.aspx");

为什么会这样?

【问题讨论】:

    标签: c# url routing navigation


    【解决方案1】:

    我在帐户文件夹下添加了一个配置文件 似乎它解决了登录页面的问题,但注册页面的问题仍然存在。

    <allow users="*" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-28
      • 1970-01-01
      • 1970-01-01
      • 2021-08-05
      相关资源
      最近更新 更多