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. Web Development
  3. ASP.NET
  4. need some explaination about the session in as.net

need some explaination about the session in as.net

Scheduled Pinned Locked Moved ASP.NET
csharpsysadmin
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.
  • P Offline
    P Offline
    prasadbuddhika
    wrote on last edited by
    #1

    as i know the session should be created at the server, and does it create a new session for each request that a browser requests(for each page it requests) or one session for one browser, means once the browser requested the first pg then web server creates a session and keep it until the browser closes or session expires.

    A K K 3 Replies Last reply
    0
    • P prasadbuddhika

      as i know the session should be created at the server, and does it create a new session for each request that a browser requests(for each page it requests) or one session for one browser, means once the browser requested the first pg then web server creates a session and keep it until the browser closes or session expires.

      K Offline
      K Offline
      krishnaveer
      wrote on last edited by
      #2

      Hi, It does not create session on every request. Server creates session only once when you declare in your code and keep alive until you have kill it or close the browser.

      krishna veer singh

      1 Reply Last reply
      0
      • P prasadbuddhika

        as i know the session should be created at the server, and does it create a new session for each request that a browser requests(for each page it requests) or one session for one browser, means once the browser requested the first pg then web server creates a session and keep it until the browser closes or session expires.

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        Please Read[^] this article. This will resolve your query and you can also learn something new from it.

        cheers, Abhijit CodeProject MVP

        P 1 Reply Last reply
        0
        • P prasadbuddhika

          as i know the session should be created at the server, and does it create a new session for each request that a browser requests(for each page it requests) or one session for one browser, means once the browser requested the first pg then web server creates a session and keep it until the browser closes or session expires.

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

          Hi, Only one seesion value will be created

          1 Reply Last reply
          0
          • A Abhijit Jana

            Please Read[^] this article. This will resolve your query and you can also learn something new from it.

            cheers, Abhijit CodeProject MVP

            P Offline
            P Offline
            prasadbuddhika
            wrote on last edited by
            #5

            tanx, but i'm experiencing that is confucing.i use a web service to server the web application. the problem is when user login i create the session

            this.Session.Add("customer", customer.CUSTEMAIL);

            then insert it to table (db) to restrict the same user log in. in the log off method i use

             customer.CUSTEMAIL = this.Session\["customer"\].ToString();<=====A
                    
            
                    if (Customerinfo.delete\_session(customer))
                    {
                        this.Session.Abandon();
                        return "log off successful";
                    }
                    else
                    {
                        return "log off failed";
                    }
            

            to delete the record in the db and then destroy the session, but the prolem is when logging off at point A the session count is 0 means no session object and gives null ref exception, could you tell me what is going wrong here.

            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