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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. session

session

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 3 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.
  • R Offline
    R Offline
    rajeev2233
    wrote on last edited by
    #1

    how we can set and unset or destory sesstion?

    C 1 Reply Last reply
    0
    • R rajeev2233

      how we can set and unset or destory sesstion?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Buy a book on ASP.NET and read it. This is such an entry level question that even tho I will answer it, it's clear you have a lot to learn. Session["MyKey"] = "value"; // can be any type string s = (string)Session["MyKey"]; Session["MyKey"] = null; I would put the keys into a class, so that you're not always typing them, the compiler will not find typos in there. Also, I'd add methods to a base page class that safely check if a session object is null and return a bool if it is, just like the tryparse methods on classes like string.

      Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

      T 1 Reply Last reply
      0
      • C Christian Graus

        Buy a book on ASP.NET and read it. This is such an entry level question that even tho I will answer it, it's clear you have a lot to learn. Session["MyKey"] = "value"; // can be any type string s = (string)Session["MyKey"]; Session["MyKey"] = null; I would put the keys into a class, so that you're not always typing them, the compiler will not find typos in there. Also, I'd add methods to a base page class that safely check if a session object is null and return a bool if it is, just like the tryparse methods on classes like string.

        Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

        T Offline
        T Offline
        tina newcoder
        wrote on last edited by
        #3

        how about Session.Abondon();

        C 1 Reply Last reply
        0
        • T tina newcoder

          how about Session.Abondon();

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Well, I presume that clears it all, I was showing how to clear one value only.

          Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

          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