Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. session in asp.net & c#.net

session in asp.net & c#.net

Scheduled Pinned Locked Moved C#
csharpasp-nethelpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kamalesh5743
    wrote on last edited by
    #1

    Hi all, i got problem on session tracking using asp.net with c#.net.I need use session when user login into my website. thank you.

    %#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG

    E J 2 Replies Last reply
    0
    • K kamalesh5743

      Hi all, i got problem on session tracking using asp.net with c#.net.I need use session when user login into my website. thank you.

      %#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG

      E Offline
      E Offline
      Eduard Keilholz
      wrote on last edited by
      #2

      Could you tell us what your problem is?

      .: I love it when a plan comes together :. http://www.zonderpunt.nl

      K 1 Reply Last reply
      0
      • K kamalesh5743

        Hi all, i got problem on session tracking using asp.net with c#.net.I need use session when user login into my website. thank you.

        %#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG

        J Offline
        J Offline
        Jaffer Mumtaz
        wrote on last edited by
        #3

        What is the problem

        1 Reply Last reply
        0
        • E Eduard Keilholz

          Could you tell us what your problem is?

          .: I love it when a plan comes together :. http://www.zonderpunt.nl

          K Offline
          K Offline
          kamalesh5743
          wrote on last edited by
          #4

          here is my source code whn login button clicked.. can you check for me.. private void Button1_Click(object sender, System.EventArgs e) { switch (UserLogin(usertxtname.Text, usertxtpass.Text)) { case 1: Session.Abandon(); Login(); break; case 2: Label4.Text = "Incorrect Password"; break; case 3: Label4.Text = "Incorrect Username"; break; } } public void Login() { FormsAuthenticationTicket objTicket = null; HttpCookie objCookie = null; string strReturnURL = null; objTicket = new FormsAuthenticationTicket(1, usertxtname.Text, System.DateTime.Now, DateTime.Now.AddMinutes(60), false, Session.SessionID); objCookie = new HttpCookie(".ASPXAUTH"); objCookie.Value = FormsAuthentication.Encrypt(objTicket); Response.Cookies.Add(objCookie); strReturnURL = Request.QueryString["ULogin.aspx"]; if (strReturnURL != null) Response.Redirect("ULogin.aspx"); else Response.Redirect("registration.aspx", false); } public int UserLogin(string strUsername, string strPassword) { int iReturnValue = 0; string sql; OdbcConnection myconn; OdbcDataReader MyReader = null; sql="Select count(*) as expr1 From login Where (pword='"+usertxtpass.Text+"')And(uname='"+usertxtname.Text+"')"; myconn= new OdbcConnection ("DSN=myodbc2;SERVER=localhost;DATABASE=misdb;UID=root;PORT=3306"); OdbcCommand cmd = new OdbcCommand(sql, myconn); cmd.Parameters.Add("@username", strUsername); cmd.Parameters.Add("@password", strPassword); cmd.Parameters.Add("@ReturnValue", OdbcType.Int).Direction = ParameterDirection.ReturnValue; myconn.Open(); MyReader=cmd.ExecuteReader(); MyReader.Read(); **iReturnValue = System.Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value.ToString());**myconn.Close(); return iReturnValue; }

          %#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG

          M 1 Reply Last reply
          0
          • K kamalesh5743

            here is my source code whn login button clicked.. can you check for me.. private void Button1_Click(object sender, System.EventArgs e) { switch (UserLogin(usertxtname.Text, usertxtpass.Text)) { case 1: Session.Abandon(); Login(); break; case 2: Label4.Text = "Incorrect Password"; break; case 3: Label4.Text = "Incorrect Username"; break; } } public void Login() { FormsAuthenticationTicket objTicket = null; HttpCookie objCookie = null; string strReturnURL = null; objTicket = new FormsAuthenticationTicket(1, usertxtname.Text, System.DateTime.Now, DateTime.Now.AddMinutes(60), false, Session.SessionID); objCookie = new HttpCookie(".ASPXAUTH"); objCookie.Value = FormsAuthentication.Encrypt(objTicket); Response.Cookies.Add(objCookie); strReturnURL = Request.QueryString["ULogin.aspx"]; if (strReturnURL != null) Response.Redirect("ULogin.aspx"); else Response.Redirect("registration.aspx", false); } public int UserLogin(string strUsername, string strPassword) { int iReturnValue = 0; string sql; OdbcConnection myconn; OdbcDataReader MyReader = null; sql="Select count(*) as expr1 From login Where (pword='"+usertxtpass.Text+"')And(uname='"+usertxtname.Text+"')"; myconn= new OdbcConnection ("DSN=myodbc2;SERVER=localhost;DATABASE=misdb;UID=root;PORT=3306"); OdbcCommand cmd = new OdbcCommand(sql, myconn); cmd.Parameters.Add("@username", strUsername); cmd.Parameters.Add("@password", strPassword); cmd.Parameters.Add("@ReturnValue", OdbcType.Int).Direction = ParameterDirection.ReturnValue; myconn.Open(); MyReader=cmd.ExecuteReader(); MyReader.Read(); **iReturnValue = System.Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value.ToString());**myconn.Close(); return iReturnValue; }

            %#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Eduard asked what your PROBLEM is not for a code dump. X|

            Never underestimate the power of human stupidity RAH

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups