Losing Session in IIS
-
Hi Friends, I created a app in asp.net 2.0 and i published app in IIS 5.1. Both are in my machine. I've had a problem with session, but this problem is ocurring onlyu IIS 5.1. This problem doesn't ocurring when i debug the app. 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. I've already tried all ways, but a I've not had success. Can you help me? Sorry form my English, but I brazilian guy and i'm improving my English. Thanks!!
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
-
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
-
No bother mate
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
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
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,
-
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
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,
-
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,
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
-
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,
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 :-)
-
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 :-)
-
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 :-)
-
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 :-)
-
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 :-)
-
.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
-
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!!!
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.
-
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.