In this article I will explain how to use Login Control to validate user details using asp.net membership.
Description:
In previous post I explained clearly how to install asp.net membership database schema in SQL Server and create users using CreateUserWizard in asp.net membership. Here I am using these two concepts to validate user details with Login Control using asp.net membership in our login page.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Login Control to validate User Details</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Default.aspx">
</asp:Login>
</div>
</form>
</body>
</html>
|
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Login Control to validate User Details</title>
</head>
<body>
<form id="form1" runat="server">
<table align="center" width="200px">
<tr>
<td>
</td>
<td>
<asp:LoginStatus ID="LoginStatus1" runat="server" />
</td>
</tr>
<tr>
<td><asp:Label ID="lblResult" runat="server" Font-Bold="true"/></td>
<td></td>
</tr>
</table>
</form>
</body>
</html>
|
protected void Page_Load(object sender, EventArgs e)
{
lblResult.Text = "Welcome "+ Page.User.Identity.Name;
}
|
<authentication mode="Forms"/>
<authorization>
<deny users="?"/>
</authorization>
|
<connectionStrings>
<add name="dbconnection" connectionString="Data Source=SureshDasari;Initial Catalog=AspMembership;Integrated Security=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
|
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="dbconnection" applicationName="SampleApplication"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="dbconnection" applicationName="SampleApplication"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="dbconnection" applicationName="SampleApplication"/>
</providers>
</roleManager>
|
|
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|

Subscribe by RSS
Subscribe by Email
10 comments :
good yaar
goodmorning sir,can u help me on display videos in asp.net and c#
sir,please give me code for how to display videos in asp.net
i've developed a asp.net(C#) project. i used one login control for 2 tables. ie. 1st table contains blood info details, 2nd table contains job info details. 2 tables have diff username and pwd to access their accounts.
The problem is how to separate which user belongs to which redirected page. here the admin also plays his role to login. so 3 logins in one login control.
someone send code r suggestion plz..
Comments are very negotiable for this gr8 helps
Thank you for all
Hi I need one urgent help..Pls tell me how to reboot the another server using that user authentication detail in ur own asp.net web application.
Give me one example on Form based example.........
really helpful to dotnet students
how to download coding please tellme
how to connect to the administative property in login control