473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to change login menuitem to logout once logged in

its the code of profile.aspx.cs

Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.             if (Session["User"] != null)
  4.             {
  5.                 menu1.Items[7].Text = "Logout";
  6.                 //menu1.Items[1].Text = "My Account";
  7.  
  8.             }
  9.             int n = Convert .ToInt16 (Session["page"].ToString());
  10.             if (n==1)
  11.             {
  12.                 String s1 = (String)Session["fname"];
  13.                 String s2 = (String)Session["lname"];
  14.                 String s3 = (String)Session["address"];
  15.                 String s4 = (String)Session["email"];
  16.                 String s5 = (String)Session["contact"];
  17.                 Label1.Text = s1;
  18.                 Label2.Text = s1;
  19.                 Label3.Text = s2;
  20.                 Label4.Text = s3;
  21.                 Label5.Text = s4;
  22.                 Label6.Text = s5;
  23.             }
  24.              else if(n==2)
  25.             {
  26.                 String s6 = (String)Session["user"];
  27.                 String s7 = (String)Session["pass"];
  28.                 Label1.Text = s6;
  29.                 con1.Open();
  30.                 SqlCommand cmd = new SqlCommand("SELECT Firstname FROM registration WHERE (RId='" + s6 + "') AND (Password='" + s7 + "')", con1);
  31.                 String f = (String)cmd.ExecuteScalar();
  32.                 Label2.Text = f;
  33.                 SqlCommand cmd1 = new SqlCommand("SELECT Lastname FROM registration WHERE (RId='" + s6 + "') AND (Password='" + s7 + "')", con1);
  34.                 String l = (String)cmd1.ExecuteScalar();
  35.                 Label3.Text = l;
  36.                 SqlCommand cmd2 = new SqlCommand("SELECT Address FROM registration WHERE (RId='" + s6 + "') AND (Password='" + s7 + "')", con1);
  37.                 String a = (String)cmd2.ExecuteScalar();
  38.                 Label4.Text = a;
  39.                 SqlCommand cmd3 = new SqlCommand("SELECT mailid FROM registration WHERE (RId='" + s6 + "') AND (Password='" + s7 + "')", con1);
  40.                 String m = (String)cmd3.ExecuteScalar();
  41.                 Label5.Text = m;
  42.                 SqlCommand cmd4 = new SqlCommand("SELECT Contactno FROM registration WHERE (RId='" + s6 + "') AND (Password='" + s7 + "')", con1);
  43.                 String c = (String)cmd4.ExecuteScalar();
  44.                 Label6.Text = c;
  45.                 con1.Close();
  46.             }
  47.         }
Apr 13 '13 #1
1 1960
vijay6
158 100+
Hey blackberry21, What's wrong with your code?
Apr 15 '13 #2

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

Similar topics

2
by: MLH | last post by:
I have tblMemberLogins with and fields. Any member may appear in the table numerous times. How can I sum up the total time spent logged in by any member in the table, I can extract the records...
1
by: Henry Stockbridge | last post by:
Hi, I have created a UserLog table that captures the date/time the User logs in to the database (via AutoExec macro.) The UserLog also captures the date/time the User logs out (form event.) I'd...
1
by: Adarsh | last post by:
Hi, I have created a C# application and want to restrict the login of same user more than once at a time. How can I do that?
1
by: G | last post by:
Hello Friends, Can i find any sample free webbased-application for employee login and logout timing. Thanks in Advance Appreciate for your Help. Thanks G
0
by: G | last post by:
Hello Friends, Can i find any sample free webbased-application for employee login and logout timing. Thanks in Advance Appreciate for your Help. Thanks G
0
by: onlymukti4u | last post by:
Hi All, Can anyone help me out to get the code for knowing the login and logout time difference between some pages. What exactly I want is...."I have a small project having 5 pages,once the...
5
by: donaldmazig | last post by:
Hello, I am currently working in a database with user security level. What I want to add is a field in a form with type memo where all the user's name, login and logout date and time are recorded....
2
by: reddysankar | last post by:
Hi to All, iam developing one application.in that i need some coding regarding login time n date of a user for a particular day and logout details of that same user. ...
1
by: tariquetuku | last post by:
How to create a login and logout link in a php page which will affect the session variable? Any code available?
1
by: jagjit maan | last post by:
how to subtract the two times . one is login and second is logout .the time is get from the database but with two tables .one is login and second is logout .i got the both the time but how to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.