I created a new project using aspx visual studio 2010. All I am trying to do is user logs in and I redirect to another page. I am going to save some stuff either as cookies or application/session objects.
So I created a brand new aspx application with the login templates. I opened login.aspx and I opened the code behind of the login button. When the user clicks ok, I connect to my sql server database and I validate their login/password. Once I do this and determine this is a valid user, How do I tell aspx that this is a valid user?
I noticed this:
<div class="loginDisplay">
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="~/Account/Login.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="~/"/> ]
</LoggedInTemplate>
</asp:LoginView>
So I am assuming that I need to somehow say user is authenticated. But how? I guess I am a little confued on LoginTemplates VS Anonymous templates. How do I say Now use LoginTemplate vs anonymous. Is there a property or method that I have to execte?
Thanks
Try this in Login1_Authenticate:
You need to validate the user based on his details he entered.If the user passes the authentication redirect him to wherever you want.If not show him some message.
And in Login1_LoggedIn