473,505 Members | 13,982 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to display user name after login page using c#

7 New Member
Hello!!!

Can any one tell how to retrieve user name and other details like first name,address,contact no. and so on.... and display in welcome page after login page using c# and sql server plzzzzzzzzzzzz



Thanking u

Regards,
Deepshika
Nov 15 '07 #1
3 6672
debasisdas
8,127 Recognized Expert Expert
Dear Deepshika

Can you kindly post what you have tried so far to solve the mentioned problem.
Nov 15 '07 #2
Ghanathe
7 New Member
Dear Deepshika

Can you kindly post what you have tried so far to solve the mentioned problem.

<HTML>
<HEAD>
<title>Login</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table id="mainTable" border="0" style="Z-INDEX: 103; LEFT: 544px; WIDTH: 264px; POSITION: absolute; TOP: 96px; HEIGHT: 296px">
<TBODY>
<tr>
<td>
<table class="t_border" id="loginTable" cellspacing="15" cellpadding="0">
<tr>
<td align="center" colspan="2"><b>USER LOGIN</b></td>
</tr>
<tr>
<td><b>Login: </b>
</td>
<td><asp:textbox id="txtUserName" runat="server" width="128px" BackColor="LightGray" Font-Bold="True"></asp:textbox><asp:requiredfieldvalidator id="rvUserValidator" runat="server" controltovalidate="txtUserName" errormessage="You Must Enter a EmployeeId!"
display="None">*</asp:requiredfieldvalidator></td>
</tr>
<tr>
<td style="HEIGHT: 23px"><b>Password: </b>
</td>
<td style="HEIGHT: 23px"><asp:textbox id="txtPassword" runat="server" width="128px" textmode="Password" BackColor="LightGray"
Font-Bold="True"></asp:textbox><asp:requiredfieldvalidator id="rvPasswordValidator" runat="server" controltovalidate="txtPassword" errormessage="Empty Passwords not accepted"
display="None">*</asp:requiredfieldvalidator></td>
</tr>
<tr>
<td align="center" colspan="2"><asp:button id="cmdSubmit" runat="server" text="Submit" borderstyle="Solid" Font-Bold="True"></asp:button></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table id="messageDisplay">
<tr>
<td><asp:validationsummary id="Validationsummary1" runat="server" width="248px" displaymode="BulletList" Height="40px"></asp:validationsummary></td>
</tr>
</table>
</td>
</tr>
</TBODY>
</table>
</form>
<asp:label id="lblMessage2" runat="server" width="264px" font-bold="True" font-italic="True"
font-size="Medium" forecolor="#C00000" style="Z-INDEX: 101; LEFT: 544px; POSITION: absolute; TOP: 432px"></asp:label>
<asp:label id="lblMessage" runat="server" width="264px" font-bold="True" font-italic="True"
font-size="Medium" forecolor="#C00000" style="Z-INDEX: 102; LEFT: 544px; POSITION: absolute; TOP: 400px"></asp:label></TR></TBODY></TABLE>
</body>
</HTML>




private void cmdSubmit_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
if (DBConnection(txtUserName.Text.Trim(), txtPassword.Text.Trim()))
{
FormsAuthentication.RedirectFromLoginPage (txtUserName.Text, false);
Response.Redirect ("Success.aspx");
}
else
{
lblMessage.Text = "Invalid Login, please try again!";
}
}

}
private bool DBConnection(string txtUser, string txtPass)
{

SqlConnection myConn = new SqlConnection(ConfigurationSettings.AppSettings["strConn"]);
SqlCommand myCmd = new SqlCommand("ValidateUser", myConn);
myCmd.CommandType = CommandType.StoredProcedure;

SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter returnParam;

objParam1 = myCmd.Parameters.Add ("@EmployeeNumber", SqlDbType.VarChar);
objParam2 = myCmd.Parameters.Add ("@EMPPassword", SqlDbType.VarChar);
returnParam = myCmd.Parameters.Add ("@Num_of_User", SqlDbType.Int);

objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
returnParam.Direction = ParameterDirection.ReturnValue;

objParam1.Value = txtUser;
objParam2.Value = txtPass;

try
{
if (myConn.State.Equals(ConnectionState.Closed))
{
myConn.Open();
myCmd.ExecuteNonQuery();
}
if ((int)returnParam.Value < 1)
{
lblMessage.Text = "Invalid Login!";
return false;
}
else
{
myConn.Close();
return true;
}
}
catch (Exception ex)
{

lblMessage2.Text = ex + "Error Connecting to the database";
return false;
}

}
Nov 15 '07 #3
Ghanathe
7 New Member
above code is my login page if enter "login is nothing but employee number" if i enter employee number it should display employee name and other details in welcome page
Nov 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

18
2444
by: | last post by:
Please help. After a number of wrong turns and experiments I need advice on login management system to secure our web pages without inconveniencing our visitors or our internal staff. What I...
2
12680
by: Tom Loach | last post by:
Our system administrator set up an NT server group in order to allow our users to login to our application via https to our sql server. The group appears as a User in SQL Server when you look at...
9
31222
by: yezanxiong | last post by:
Hello all, I am new in asp.net developer,I would like to ask a simple question. how to display a message box in web application using asp.net? If I just use Private Sub btnOK_Click(ByVal...
6
2423
by: dale zhang | last post by:
Hi, I build a web form with a 4-cell table on the top (flawlayout), followed by some labels and textboxes (gridlayout). The web form is displayed well in dell m60 laptop with all resolution...
5
2062
by: Michelle Stone | last post by:
Hi everybody I am writing a simple asp.net application using form authentication. I store the list of all users and their passwords in an SQL Server database table. My client recently told me...
5
2264
by: Rajani | last post by:
Hello, I have a strange problem. I want to check the privilege of the login user on each page and allow to display if has suff. priv. I am storing the privilege is session variable. I am...
7
3176
by: Samuel | last post by:
Hi, I am building a page that makes use of user control as a templating technique. The following is that I have in mind and it is actually working: Root/ -- login.aspx -- login.aspx.vb --...
2
2591
by: dgbergman | last post by:
I have created a php login page in my site for my company. The goal is to get people into members area. Below is a list of steps that I take to create my login page in Dreamweaver CS3, can some one...
4
5795
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.