473,756 Members | 2,900 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,co ntact 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 6689
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="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema" content="http://schemas.microso ft.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:textbo x id="txtUserName " runat="server" width="128px" BackColor="Ligh tGray" Font-Bold="True"></asp:textbox><as p:requiredfield validator id="rvUserValid ator" runat="server" controltovalida te="txtUserName " errormessage="Y ou Must Enter a EmployeeId!"
display="None"> *</asp:requiredfie ldvalidator></td>
</tr>
<tr>
<td style="HEIGHT: 23px"><b>Passwo rd: </b>
</td>
<td style="HEIGHT: 23px"><asp:text box id="txtPassword " runat="server" width="128px" textmode="Passw ord" BackColor="Ligh tGray"
Font-Bold="True"></asp:textbox><as p:requiredfield validator id="rvPasswordV alidator" runat="server" controltovalida te="txtPassword " errormessage="E mpty Passwords not accepted"
display="None"> *</asp:requiredfie ldvalidator></td>
</tr>
<tr>
<td align="center" colspan="2"><as p:button id="cmdSubmit" runat="server" text="Submit" borderstyle="So lid" Font-Bold="True"></asp:button></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table id="messageDisp lay">
<tr>
<td><asp:valida tionsummary id="Validations ummary1" runat="server" width="248px" displaymode="Bu lletList" Height="40px"></asp:validations ummary></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="#C00 000" 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="#C00 000" style="Z-INDEX: 102; LEFT: 544px; POSITION: absolute; TOP: 400px"></asp:label></TR></TBODY></TABLE>
</body>
</HTML>




private void cmdSubmit_Click (object sender, System.EventArg s e)
{
if (Page.IsValid)
{
if (DBConnection(t xtUserName.Text .Trim(), txtPassword.Tex t.Trim()))
{
FormsAuthentica tion.RedirectFr omLoginPage (txtUserName.Te xt, false);
Response.Redire ct ("Success.aspx" );
}
else
{
lblMessage.Text = "Invalid Login, please try again!";
}
}

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

SqlConnection myConn = new SqlConnection(C onfigurationSet tings.AppSettin gs["strConn"]);
SqlCommand myCmd = new SqlCommand("Val idateUser", myConn);
myCmd.CommandTy pe = CommandType.Sto redProcedure;

SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter returnParam;

objParam1 = myCmd.Parameter s.Add ("@EmployeeNumb er", SqlDbType.VarCh ar);
objParam2 = myCmd.Parameter s.Add ("@EMPPassword" , SqlDbType.VarCh ar);
returnParam = myCmd.Parameter s.Add ("@Num_of_User" , SqlDbType.Int);

objParam1.Direc tion = ParameterDirect ion.Input;
objParam2.Direc tion = ParameterDirect ion.Input;
returnParam.Dir ection = ParameterDirect ion.ReturnValue ;

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

try
{
if (myConn.State.E quals(Connectio nState.Closed))
{
myConn.Open();
myCmd.ExecuteNo nQuery();
}
if ((int)returnPar am.Value < 1)
{
lblMessage.Text = "Invalid Login!";
return false;
}
else
{
myConn.Close();
return true;
}
}
catch (Exception ex)
{

lblMessage2.Tex t = 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
2474
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 need: A system whereby the user only has to register ONCE and he will have automatic entry to ANY page without havinto to RE-LOGIN even if he comes in
2
12692
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 it in Enterprise Manager. That said, I can not see the users associated with the group from Enterprise Manager, but know they can login to the database. The problem is this. When we login via the web we get access to the database without...
9
31246
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 sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click MsgBox("please enter the correct user name and password",
6
2434
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 options and DPI options. However when I tried to run it in a dell P3 desktop, labels and textboxes overlapped each other and they were in table area too. Any suggestions? Do I have to put all controls in table cells?
5
2072
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 that he wants me to do something through which only one user can login using any given account name. I mean to say, for example, when a user called "abc" is online, another person shouldn't be
5
2280
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 checking on the page_load event like if session("uid")="" then response.redirect("loginverify.aspx?er=nlog") elseif session("priv")<>0 then response.redirect("loginverify.aspx?er=nsad")
7
3195
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 -- UC/ ----- Classic/
2
2604
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 verify that I have built the page correct and that is nothing wrong with the code. If there is something wrong with the code is it possible to explain a step by step process to have a successful login page as I am new to creting php codes and pages in...
4
5810
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 article: http://support.microsoft.com/?id=306158#4 This doesn't work in Windows 2008 Server, we receive the following exception:
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2666
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.