点击我的登录按钮后,它应该重定向到“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>
答案 0 :(得分: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>