473,796 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session state doesn't work

I have put a string into Session and tried to retrieve it on the next page I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET 2003.

Can there be anything else preventing me from using Session state?
Aug 16 '06 #1
9 2218
Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:A7******** *************** ***********@mic rosoft.com...
>I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?

Aug 16 '06 #2
Hi Karl,

no, I am using Server.Transfer to go from page to page within my application.

"Karl Seguin [MVP]" wrote:
Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:A7******** *************** ***********@mic rosoft.com...
I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?


Aug 16 '06 #3
Both Response.Redire ct and Server.Transfer call Response.End internally,
so you'll have the same problem with either.

Use Server.Execute, instead of Server.Transfer .
That will get rid of your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:BD******** *************** ***********@mic rosoft.com...
Hi Karl,

no, I am using Server.Transfer to go from page to page within my application.

"Karl Seguin [MVP]" wrote:
>Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
news:A7******* *************** ************@mi crosoft.com...
>I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?

Aug 16 '06 #4
Thank you for the reply Juan,

but I need to know why this is happening on just my computer. If I type the
same code onto another computer and use Server.Transer or Response.Redire ct
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:
Both Response.Redire ct and Server.Transfer call Response.End internally,
so you'll have the same problem with either.

Use Server.Execute, instead of Server.Transfer .
That will get rid of your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:BD******** *************** ***********@mic rosoft.com...
Hi Karl,

no, I am using Server.Transfer to go from page to page within my application.

"Karl Seguin [MVP]" wrote:
Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:A7******** *************** ***********@mic rosoft.com...
I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?


Aug 16 '06 #5
Please review this KB :
http://support.microsoft.com/kb/312629/EN-US

Although that KB originated in response to a different problem,
it has the answers to your problem in it.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:BC******** *************** ***********@mic rosoft.com...
Thank you for the reply Juan,

but I need to know why this is happening on just my computer. If I type the
same code onto another computer and use Server.Transer or Response.Redire ct
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:
>Both Response.Redire ct and Server.Transfer call Response.End internally,
so you'll have the same problem with either.

Use Server.Execute, instead of Server.Transfer .
That will get rid of your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.co m : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== ======
"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
news:BD******* *************** ************@mi crosoft.com...
Hi Karl,

no, I am using Server.Transfer to go from page to page within my application.

"Karl Seguin [MVP]" wrote:

Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
news:A7******* *************** ************@mi crosoft.com...
I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?



Aug 16 '06 #6
Hi there,

"Cashdeskma c" was trying to help with a problem that has occured on my
computer (thanks Allen!).

I have read the responses from Juan and Karl (thanks also for your
responses) but unfortunately the solutions given do not entirely resolve the
problem.

Yes, when I use Server.Execute instead of Server.Transfer the session state
is maintained. But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redire ct("WebForm.asp x", false);

I get the following exception in the browser:
Server Error in '/WebApplication2 ' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:
Line 21: private void Page_Load(objec t sender, System.EventArg s e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
Source File: c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs Line: 23

Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
WebApplication2 .WebForm.Page_L oad(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs:23
System.Web.UI.C ontrol.OnLoad(E ventArgs e)
System.Web.UI.C ontrol.LoadRecu rsive()
System.Web.UI.P age.ProcessRequ estMain()
Thanks again for your help
Jon

"Juan T. Llibre" wrote:
Please review this KB :
http://support.microsoft.com/kb/312629/EN-US

Although that KB originated in response to a different problem,
it has the answers to your problem in it.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:BC******** *************** ***********@mic rosoft.com...
Thank you for the reply Juan,

but I need to know why this is happening on just my computer. If I type the
same code onto another computer and use Server.Transer or Response.Redire ct
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:
Both Response.Redire ct and Server.Transfer call Response.End internally,
so you'll have the same problem with either.

Use Server.Execute, instead of Server.Transfer .
That will get rid of your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:BD******** *************** ***********@mic rosoft.com...
Hi Karl,

no, I am using Server.Transfer to go from page to page within my application.

"Karl Seguin [MVP]" wrote:

Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:A7******** *************** ***********@mic rosoft.com...
I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?


Aug 17 '06 #7
Hi, Jon.

re:
Yes, when I use Server.Execute instead
of Server.Transfer the session state is maintained.
That is correct...and that fixes your problem.

re:
But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
Don't use Response.Redire ct.
Use Server.Execute *instead* of using Response.Redire ct.

re:
But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
If you can repro that, bug it at the
Visual Studio and .NET Framework Feedback page :

http://connect.microsoft.com/feedbac...spx?SiteID=210

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Seven" <Se***@discussi ons.microsoft.c omwrote in message
news:64******** *************** ***********@mic rosoft.com...
Hi there,

"Cashdeskma c" was trying to help with a problem that has occured on my
computer (thanks Allen!).

I have read the responses from Juan and Karl (thanks also for your
responses) but unfortunately the solutions given do not entirely resolve the
problem.

Yes, when I use Server.Execute instead of Server.Transfer the session state
is maintained. But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redire ct("WebForm.asp x", false);

I get the following exception in the browser:
Server Error in '/WebApplication2 ' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:
Line 21: private void Page_Load(objec t sender, System.EventArg s e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
Source File: c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs Line: 23

Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
WebApplication2 .WebForm.Page_L oad(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs:23
System.Web.UI.C ontrol.OnLoad(E ventArgs e)
System.Web.UI.C ontrol.LoadRecu rsive()
System.Web.UI.P age.ProcessRequ estMain()
Thanks again for your help
Jon

"Juan T. Llibre" wrote:
>Please review this KB :
http://support.microsoft.com/kb/312629/EN-US

Although that KB originated in response to a different problem,
it has the answers to your problem in it.


Juan T. Llibre, asp.net MVP
aspnetfaq.co m : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== ======
"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
news:BC******* *************** ************@mi crosoft.com...
Thank you for the reply Juan,

but I need to know why this is happening on just my computer. If I type the
same code onto another computer and use Server.Transer or Response.Redire ct
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:

Both Response.Redire ct and Server.Transfer call Response.End internally,
so you'll have the same problem with either.

Use Server.Execute, instead of Server.Transfer .
That will get rid of your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.co m : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
============== =============== ======
"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
news:BD******* *************** ************@mi crosoft.com...
Hi Karl,

no, I am using Server.Transfer to go from page to page within my application.

"Karl Seguin [MVP]" wrote:

Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
news:A7******* *************** ************@mi crosoft.com...
I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?



Aug 17 '06 #8
Hi Juan,

as Jon pointed out, I posted this in order to solve his problem.

The main issue we have is that when I use Response.Redire ct or
Server.Transfer on MY computer, Session variables are maintained without any
problems. It is only on JON's computer that the issue occurs.

Do you know of any setting on his computer which could be to blame?

"Juan T. Llibre" wrote:
Hi, Jon.

re:
Yes, when I use Server.Execute instead
of Server.Transfer the session state is maintained.

That is correct...and that fixes your problem.

re:
But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?

Don't use Response.Redire ct.
Use Server.Execute *instead* of using Response.Redire ct.

re:
But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?

If you can repro that, bug it at the
Visual Studio and .NET Framework Feedback page :

http://connect.microsoft.com/feedbac...spx?SiteID=210

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Seven" <Se***@discussi ons.microsoft.c omwrote in message
news:64******** *************** ***********@mic rosoft.com...
Hi there,

"Cashdeskma c" was trying to help with a problem that has occured on my
computer (thanks Allen!).

I have read the responses from Juan and Karl (thanks also for your
responses) but unfortunately the solutions given do not entirely resolve the
problem.

Yes, when I use Server.Execute instead of Server.Transfer the session state
is maintained. But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redire ct("WebForm.asp x", false);

I get the following exception in the browser:
Server Error in '/WebApplication2 ' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.

Source Error:
Line 21: private void Page_Load(objec t sender, System.EventArg s e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
Source File: c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs Line: 23

Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
WebApplication2 .WebForm.Page_L oad(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs:23
System.Web.UI.C ontrol.OnLoad(E ventArgs e)
System.Web.UI.C ontrol.LoadRecu rsive()
System.Web.UI.P age.ProcessRequ estMain()
Thanks again for your help
Jon

"Juan T. Llibre" wrote:
Please review this KB :
http://support.microsoft.com/kb/312629/EN-US

Although that KB originated in response to a different problem,
it has the answers to your problem in it.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:BC******** *************** ***********@mic rosoft.com...
Thank you for the reply Juan,

but I need to know why this is happening on just my computer. If I type the
same code onto another computer and use Server.Transer or Response.Redire ct
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:

Both Response.Redire ct and Server.Transfer call Response.End internally,
so you'll have the same problem with either.

Use Server.Execute, instead of Server.Transfer .
That will get rid of your problem.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:BD******** *************** ***********@mic rosoft.com...
Hi Karl,

no, I am using Server.Transfer to go from page to page within my application.

"Karl Seguin [MVP]" wrote:

Are you using a Response.Redire ct after setting the session? If so, take a
look at:
http://weblogs.asp.net/bleroy/archiv...03/207486.aspx

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:A7******** *************** ***********@mic rosoft.com...
I have put a string into Session and tried to retrieve it on the next page
I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:

Session["name"] = "john";

On the next page:

txtName.Text = Session["name"];

I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.

I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).

This happens in any of the applications I create in Visual Studio .NET
2003.

Can there be anything else preventing me from using Session state?



Aug 21 '06 #9
Hi,

Just to let you all know that this issue was resolved by either switching
off my zone alarm privacy settings (to allow browsers to accept cookies) or
by changing the "cookieless " setting in the <sessionState of the web.config
file to "true" so that Session state was maintianed through the URL rather
than through cookies.

Thank you all for your help.

Rgds
Jon

"cashdeskma c" wrote:
Hi Juan,

as Jon pointed out, I posted this in order to solve his problem.

The main issue we have is that when I use Response.Redire ct or
Server.Transfer on MY computer, Session variables are maintained without any
problems. It is only on JON's computer that the issue occurs.

Do you know of any setting on his computer which could be to blame?

"Juan T. Llibre" wrote:
Hi, Jon.

re:
Yes, when I use Server.Execute instead
of Server.Transfer the session state is maintained.
That is correct...and that fixes your problem.

re:
But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
Don't use Response.Redire ct.
Use Server.Execute *instead* of using Response.Redire ct.

re:
But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
If you can repro that, bug it at the
Visual Studio and .NET Framework Feedback page :

http://connect.microsoft.com/feedbac...spx?SiteID=210

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Seven" <Se***@discussi ons.microsoft.c omwrote in message
news:64******** *************** ***********@mic rosoft.com...
Hi there,
>
"Cashdeskma c" was trying to help with a problem that has occured on my
computer (thanks Allen!).
>
I have read the responses from Juan and Karl (thanks also for your
responses) but unfortunately the solutions given do not entirely resolve the
problem.
>
Yes, when I use Server.Execute instead of Server.Transfer the session state
is maintained. But if I place the appropriate "Response.Redir ect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redire ct("WebForm.asp x", false);
>
I get the following exception in the browser:
Server Error in '/WebApplication2 ' Application.
--------------------------------------------------------------------------------
>
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.
>
Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.
>
Source Error:
>
>
Line 21: private void Page_Load(objec t sender, System.EventArg s e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
>
>
Source File: c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs Line: 23
>
Stack Trace:
>
>
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
WebApplication2 .WebForm.Page_L oad(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\webapplicat ion2\webform.as px.cs:23
System.Web.UI.C ontrol.OnLoad(E ventArgs e)
System.Web.UI.C ontrol.LoadRecu rsive()
System.Web.UI.P age.ProcessRequ estMain()
>
>
Thanks again for your help
Jon
>
"Juan T. Llibre" wrote:
>
>Please review this KB :
>http://support.microsoft.com/kb/312629/EN-US
>>
>Although that KB originated in response to a different problem,
>it has the answers to your problem in it.
>>
>>
>>
>>
>Juan T. Llibre, asp.net MVP
>aspnetfaq.co m : http://www.aspnetfaq.com/
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en español : http://asp.net.do/foros/
>============== =============== ======
>"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
>news:BC******* *************** ************@mi crosoft.com...
Thank you for the reply Juan,
>
but I need to know why this is happening on just my computer. If I type the
same code onto another computer and use Server.Transer or Response.Redire ct
it works fine, and so I assume that there is a problem with the settings on
my machine.
>
"Juan T. Llibre" wrote:
>
>Both Response.Redire ct and Server.Transfer call Response.End internally,
>so you'll have the same problem with either.
>>
>Use Server.Execute, instead of Server.Transfer .
>That will get rid of your problem.
>>
>>
>>
>>
>Juan T. Llibre, asp.net MVP
>aspnetfaq.co m : http://www.aspnetfaq.com/
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en español : http://asp.net.do/foros/
>============== =============== ======
>"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
>news:BD******* *************** ************@mi crosoft.com...
Hi Karl,
>
no, I am using Server.Transfer to go from page to page within my application.
>
"Karl Seguin [MVP]" wrote:
>
>Are you using a Response.Redire ct after setting the session? If so, take a
>look at:
>http://weblogs.asp.net/bleroy/archiv...03/207486.aspx
>>
>Karl
>>
>--
>http://www.openmymind.net/
>http://www.codebetter.com/
>>
>>
>"cashdeskmac " <ca*********@di scussions.micro soft.comwrote in message
>news:A7******* *************** ************@mi crosoft.com...
>I have put a string into Session and tried to retrieve it on the next page
>I
visit but the Session appears empty. I have exactly the same spelling for
both adding and retrieving the value:
>
Session["name"] = "john";
>
On the next page:
>
txtName.Text = Session["name"];
>
I tried it with .ToString() and in an if statement to make sure it has a
value but it always shows as null.
>
I have not modified IIS in any way since installing it ( and I have
checked
that Session is enabled in the IIS console).
>
This happens in any of the applications I create in Visual Studio .NET
2003.
>
Can there be anything else preventing me from using Session state?
>>
>>
>>
>>
>>
>>
Oct 29 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3659
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of these menus are then placed into the page by calling Server.Execute(rs_Modules("ModulePath")). This works fine for up to 15 "menus" After that, the session variables that were set (not including those called by Global.ASA) are no longer set. ...
14
3242
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you go to is a login form, which will set several session variables with the name used to log in, appropriate security level and some other misc variables, and then will go to a main menu for each particular security level using Server.Transfer. ...
9
2387
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use - perhaps I'm just not very smart or perhaps MS is making this too hard for us sql bunnies to understand - I dunno, but I'd really appreciate someone explaining what I'm doing wrong here & perhaps suggest a better approach.. I'm familiar with use of...
3
3445
by: Mark | last post by:
Ok, I know that .net inherently does not share session data across asp.net projects, but is there any decent work around to this. We already have a big chunk of our application using the asp.net session object (using state service). I'd like to start breaking out our functionality into component projects, but I'd like to get this session issue worked out first. Any ideas?? I found this article , but it sounds like kind of a pain.
1
2415
by: Johan Nedin | last post by:
Hello! I have a problem with SQLSession state on my ASP.NET pages. SQLSession state behaves very different from InProcess session state, which I think is very bad. I can understand some of the differences, e.g that every object you store in SQLSession state have to be serializable, but other differences are very unfortunate.
3
3317
by: bennett | last post by:
In the web.config file for my application, in the <sessionState> section I have set timeout="120" (in minutes), but session state variables in my application seem to be expiring in about 5 minutes. Any idea what could cause this? I have the mode="InProc" attribute set for <sessionState>. I know that some people have solved the problem of session variables timing out too quickly by changing that attribute, but I cannot use...
10
3517
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout or will a postback also do it? This is important as we have a few pages that a user
6
3258
by: Tony | last post by:
I can't seem to get the session_end event to work? I've tried to update databases in it and response.redirect to someplace else. Nothing works. I load page and leave it for 60 minutes and I know that the session id expired. I used session.abandon and it didn't fire the session_end. How can I test this? What is a good way to test if it's working?
6
2437
by: Kermit Piper | last post by:
Hello, I thought this should be easy, but... all I want to do is set the value of this state drop-down based on a session var I'm getting back from a redirect (from the processing page): <% tax = session("Tax") city = session("City") state = session("State") %>
18
3446
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that File-New-Window creates an instance of IE in the same process with the same SessionID as the parent window is in big trouble. This fundamentally restricts the usefullness of using session state management. I probably missed it somewhere - can...
0
9684
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9530
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10236
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.