I have a login control in login.aspx page that validates user by checking in database for username password using a stored procedure(Validation() method given below).I have used the following code
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Validation(Login1.UserName, Login1.Password))
{
Session["Logged"] = "Yes";
Session["User"] = "Admin";
Session["msg"] = "";
e.Authenticated = true;
Response.Redirect("/umkgp/admin/gallerymanager.aspx");
// "Successfully Logged In";
}
else
{
e.Authenticated = false;
}
}
Now when I am using LoginStatus control it is not changing display text from login to logout.I know that LoginStatus control based on IsAuthenticated property.In my case i guess IsAuthenticated is not set to true.How to make it work.Here is the code for LoginStatus control
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="/umkgp/admin/admin.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
</AnonymousTemplate>
<LoggedInTemplate>
Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
[ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="/umkgp/home.aspx" OnLoggingOut="Logout_Click"/> ]
</LoggedInTemplate>
</asp:LoginView>
(n.b.I have not used membership or roles).Please help me…
Replace this line
with this one
Update: If you want to set a default location go open your web.cofig file and find the authentication tag
and modify it this way