1

单击登录按钮后,它应该重定向到“Edit.aspx”。当它打开页面时,它只显示母版页中的内容。

这是 EnterSite.aspx 的代码:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Login ID="Login1" runat="server" DestinationPageUrl="Edit.aspx" OnAuthenticate="MyLogin_Authenticate">
</asp:Login>

</asp:Content>

这是后面的代码:

protected void MyLogin_Authenticate(object sender, AuthenticateEventArgs e)
{
    string User = Login1.UserName;
    string Pass = Login1.Password;
    if (User == "Admin" && Pass == "Hello1234")
        e.Authenticated = true;
}

这是 Edit.aspx 的代码:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <asp:Menu ID="ManageBlogPosts" runat="server" Text="Manage Blog Entries" NavigateUrl="ManageBlogPost.aspx"></asp:Menu>
    <asp:Menu ID="ManageStreetPhotos" runat="server" Text="Manage Street Photos" NavigateUrl="ManageStreetPhotos.aspx"></asp:Menu>
    <asp:Menu ID="ManagePeoplePhotos" runat="server" Text="Manage People Photos" NavigateUrl="ManagePeoplePhotos.aspx"></asp:Menu>


</asp:Content>
4

1 回答 1

1

要制作菜单,请使用:

<asp:Menu ID="ManageBlogPosts" runat="server" Text="Manage Blog Entries" NavigateUrl="ManageBlogPost.aspx">
    <Items>
        <asp:MenuItem NavigateUrl="~/a.aspx" Text="a" Value="a"></asp:MenuItem>
        <asp:MenuItem NavigateUrl="~/b.aspx" Text="b" Value="b"></asp:MenuItem>
        <asp:MenuItem NavigateUrl="~/c.aspx" Text="c" Value="c"></asp:MenuItem>
    </Items>
</asp:Menu>
于 2013-09-17T01:49:35.287 回答