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. Losing Session in IIS

Losing Session in IIS

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netwindows-admindebugging
19 Posts 5 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.
  • N N a v a n e e t h

    Member 3015509 wrote:

    The sessions are losing is postback and in other cases. But only IIS 5.1, in the asp.net 2.0 it dosoen't ocurr.

    This is not clear. Please explain it more. Also some sample code would be helpful

    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

    L Offline
    L Offline
    Leandrao
    wrote on last edited by
    #9

    Ok, Let's go... Code: the first moment, this code is called in load method **************************************** dim ds as dataset ds = obj.list ' the method return a dataset of products listbox1.DataSource = ds listbox1.DataTextField = "Name" listbox1.DataValueField = "ID" listbox1.DataBind() Session("ds") = ds **************************************** the second moment, this code is called in detail method, when select a item in listbox1 **************************************** ds = Session("ds") Dim dr() As DataRow = ds.Tables(0).Select("ID = " & listbox1.SelectedValue) txtName.Text = dr(0)("Name") txtDescript.Text = dr(0)("Descript") lblNameSystem.Text = dr(0)("NameSystem") **************************************** The Error: Object not istance. I identified that error is ocurring in Session("ds"), but is ocurring only IIS 5.1., in debug it isn't ocurrign. Did you understand me? Thanks,

    N S 2 Replies Last reply
    0
    • E eyeseetee

      ah i was wrong didnt realise it works in 5 sorry!

      L Offline
      L Offline
      Leandrao
      wrote on last edited by
      #10

      I'm Sure, When select item in listbox1, session is losed!! Why is ocurring?? Is needin some configuration in IIS or asp.net 2.0?:confused: Thanks,

      1 Reply Last reply
      0
      • L Leandrao

        Ok, Let's go... Code: the first moment, this code is called in load method **************************************** dim ds as dataset ds = obj.list ' the method return a dataset of products listbox1.DataSource = ds listbox1.DataTextField = "Name" listbox1.DataValueField = "ID" listbox1.DataBind() Session("ds") = ds **************************************** the second moment, this code is called in detail method, when select a item in listbox1 **************************************** ds = Session("ds") Dim dr() As DataRow = ds.Tables(0).Select("ID = " & listbox1.SelectedValue) txtName.Text = dr(0)("Name") txtDescript.Text = dr(0)("Descript") lblNameSystem.Text = dr(0)("NameSystem") **************************************** The Error: Object not istance. I identified that error is ocurring in Session("ds"), but is ocurring only IIS 5.1., in debug it isn't ocurrign. Did you understand me? Thanks,

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #11

        Leandrão wrote:

        dim ds as dataset

        Leandrão wrote:

        Object not istance.

        I guess you haven't declared the dataset again in the event. Or you may consider declaring it outside the pageload. Also the page_load code should be put inside If not isPostBack block, else the dataset will be created and filled to session each time page posts back.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        1 Reply Last reply
        0
        • L Leandrao

          Ok, Let's go... Code: the first moment, this code is called in load method **************************************** dim ds as dataset ds = obj.list ' the method return a dataset of products listbox1.DataSource = ds listbox1.DataTextField = "Name" listbox1.DataValueField = "ID" listbox1.DataBind() Session("ds") = ds **************************************** the second moment, this code is called in detail method, when select a item in listbox1 **************************************** ds = Session("ds") Dim dr() As DataRow = ds.Tables(0).Select("ID = " & listbox1.SelectedValue) txtName.Text = dr(0)("Name") txtDescript.Text = dr(0)("Descript") lblNameSystem.Text = dr(0)("NameSystem") **************************************** The Error: Object not istance. I identified that error is ocurring in Session("ds"), but is ocurring only IIS 5.1., in debug it isn't ocurrign. Did you understand me? Thanks,

          S Offline
          S Offline
          Sankar Komma
          wrote on last edited by
          #12

          I hope casting required when assin session dataset to local object dataset. I just modified your code as follows the second moment, this code is called in detail method, when select a item in listbox1 **************************************** ds = DirectCast(Session("ds"), Dataset) Dim dr() As DataRow = ds.Tables(0).Select("ID = " & listbox1.SelectedValue) txtName.Text = dr(0)("Name") txtDescript.Text = dr(0)("Descript") lblNameSystem.Text = dr(0)("NameSystem") ****************************************

          smile :-)

          L 2 Replies Last reply
          0
          • S Sankar Komma

            I hope casting required when assin session dataset to local object dataset. I just modified your code as follows the second moment, this code is called in detail method, when select a item in listbox1 **************************************** ds = DirectCast(Session("ds"), Dataset) Dim dr() As DataRow = ds.Tables(0).Select("ID = " & listbox1.SelectedValue) txtName.Text = dr(0)("Name") txtDescript.Text = dr(0)("Descript") lblNameSystem.Text = dr(0)("NameSystem") ****************************************

            smile :-)

            L Offline
            L Offline
            Leandrao
            wrote on last edited by
            #13

            Ok, I'm going to see it. Thanks

            1 Reply Last reply
            0
            • S Sankar Komma

              I hope casting required when assin session dataset to local object dataset. I just modified your code as follows the second moment, this code is called in detail method, when select a item in listbox1 **************************************** ds = DirectCast(Session("ds"), Dataset) Dim dr() As DataRow = ds.Tables(0).Select("ID = " & listbox1.SelectedValue) txtName.Text = dr(0)("Name") txtDescript.Text = dr(0)("Descript") lblNameSystem.Text = dr(0)("NameSystem") ****************************************

              smile :-)

              L Offline
              L Offline
              Leandrao
              wrote on last edited by
              #14

              Hi, The problem is continuing!!! I don't know like solve it. Thanks,

              S 1 Reply Last reply
              0
              • L Leandrao

                Hi, The problem is continuing!!! I don't know like solve it. Thanks,

                S Offline
                S Offline
                Sankar Komma
                wrote on last edited by
                #15

                can you provide at what level(i.e line) the error is getting and what error. In c# it is compilation error if we don't cast session dataset.

                smile :-)

                L 1 Reply Last reply
                0
                • S Sankar Komma

                  can you provide at what level(i.e line) the error is getting and what error. In c# it is compilation error if we don't cast session dataset.

                  smile :-)

                  L Offline
                  L Offline
                  Leandrao
                  wrote on last edited by
                  #16

                  I created a new page and used simple code testing session with string ("its my text"). The error ocurred. I'm thinking to myself that this error is in IIS!! Because it isn't ocurring in deployment!!!

                  P 1 Reply Last reply
                  0
                  • N N a v a n e e t h

                    .netman wrote:

                    I think only iis 6 works with asp.net 2

                    Nope, IIS 5.1 works well

                    All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

                    L Offline
                    L Offline
                    Leandrao
                    wrote on last edited by
                    #17

                    People, I'm caming back because session in my app isn't working correctly. I did a simple code: in load method : session("test")= "hello world" in click button response.write (session("test")) What can I do?

                    1 Reply Last reply
                    0
                    • L Leandrao

                      I created a new page and used simple code testing session with string ("its my text"). The error ocurred. I'm thinking to myself that this error is in IIS!! Because it isn't ocurring in deployment!!!

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #18

                      Leandrão wrote:

                      . I'm thinking to myself that this error is in IIS!!

                      Unlikely. While it must be tempting for you to think that your code is better than Microsoft's, it's probably pretty unlikely. I would suspect that your problem has more to do with you using the wrong SessionState type or just assigning it in the wrong place.

                      Deja View - the feeling that you've seen this post before.

                      My blog | My articles

                      L 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        Leandrão wrote:

                        . I'm thinking to myself that this error is in IIS!!

                        Unlikely. While it must be tempting for you to think that your code is better than Microsoft's, it's probably pretty unlikely. I would suspect that your problem has more to do with you using the wrong SessionState type or just assigning it in the wrong place.

                        Deja View - the feeling that you've seen this post before.

                        My blog | My articles

                        L Offline
                        L Offline
                        Leandrao
                        wrote on last edited by
                        #19

                        Hi Pete, I've already discovered the error. The error was caused because name resolution in domain. My code was correct and IIS too, but the network's configuration was wrong. Thanks my friend!!! :-D

                        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