Login View with the custom login control [Resolved]

Posted by Saratvaddilli under ASP.NET on 9/27/2012 | Points: 10 | Views : 2646 | Status : [Member] [MVP] | Replies : 2
Hi good morning to all,
i am using my own login control in my website , i am not using the login control provided by asp.net ,
now i want to show the login view how can i achive this one ,
i want to show the user name who was logged in like Welcome saratlogout

Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are



Responses

Posted by: Jayakumars on: 9/27/2012 [Member] [MVP] Bronze | Points: 50

Up
0
Down

Resolved
hi

Client Side

<asp:Login ID="Login2" runat="server" onauthenticate="Login2_Authenticate">
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center" colspan="2">
Log In</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="Login2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
</td>
<td>
<asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server"
ControlToValidate="Password" ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="Login2">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In"
ValidationGroup="Login2" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:Login>


server Side Code

protected void Login2_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Login2.UserName == "Jesus" && Login2.Password == "123")
{
//true code
}
else {//false Code }
}


Mark as Answer if its helpful to you

Saratvaddilli, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jayakumars on: 9/27/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

Please mark as answer if it helpful to you.

Mark as Answer if its helpful to you

Saratvaddilli, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response