I have a asp.net web application, that allows users to login and logout. When a user logs in (no problem) its says Welcome Username, which is fine. But next to it still says login. Can anyone help me is there some property i need to set on Logged in? Thanks for any help.
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="~/Account/Login.aspx" id="HeadLoginStatus" runat="server">Log In</a>
]
</AnonymousTemplate>
<LoggedInTemplate>
<span class="bold">Welcome</span><span class="bold">
<asp:LoginName ID="HeadLoginName" runat="server" />
</span>! [
<asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out"
LogoutPageUrl="~/" />
]
</LoggedInTemplate>
</asp:LoginView>
protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
{
SqlHelper userLogin = new SqlHelper();
TextBox User = (TextBox) LoginUser.FindControl("UserName");
TextBox Password = (TextBox) LoginUser.FindControl("Password");
bool results = userLogin.UserLogin(User.Text, Password.Text);
e.Authenticated = results;
}
You have two controls with an ID of HeadLoginStatus. Is there a reason for that? Secondly, have you tried removing EnableViewState=”false”?
EDIT
Try changing the startup page to a page in the root directory, if it’s not already. See if this makes any difference.