By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,776 Members | 1,351 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,776 IT Pros & Developers. It's quick & easy.

Session state doesn't work

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
Are you using a Response.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.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

P: n/a
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.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.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

P: n/a
Both Response.Redirect 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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BD**********************************@microsof t.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.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microso ft.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

P: n/a
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.Redirect
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:
Both Response.Redirect 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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BD**********************************@microsof t.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.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.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

P: n/a
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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BC**********************************@microsof t.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.Redirect
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:
>Both Response.Redirect 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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BD**********************************@microso ft.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.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microso ft.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

P: n/a
Hi there,

"Cashdeskmac" 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.Redirect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redirect("WebForm.aspx", 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.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
Line 21: private void Page_Load(object sender, System.EventArgs e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
Source File: c:\inetpub\wwwroot\webapplication2\webform.aspx.cs Line: 23

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
WebApplication2.WebForm.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\webapplication2\webform.aspx.cs :23
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BC**********************************@microsof t.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.Redirect
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:
Both Response.Redirect 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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BD**********************************@microsof t.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.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.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

P: n/a
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.Redirect" code in (as
stated in both responses), sessions state is not maintained?
Don't use Response.Redirect.
Use Server.Execute *instead* of using Response.Redirect.

re:
But if I place the appropriate "Response.Redirect" 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***@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.com...
Hi there,

"Cashdeskmac" 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.Redirect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redirect("WebForm.aspx", 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.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
Line 21: private void Page_Load(object sender, System.EventArgs e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
Source File: c:\inetpub\wwwroot\webapplication2\webform.aspx.cs Line: 23

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
WebApplication2.WebForm.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\webapplication2\webform.aspx.cs :23
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BC**********************************@microso ft.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.Redirect
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:

Both Response.Redirect 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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BD**********************************@microso ft.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.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microso ft.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

P: n/a
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.Redirect 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.Redirect" code in (as
stated in both responses), sessions state is not maintained?

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

re:
But if I place the appropriate "Response.Redirect" 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***@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.com...
Hi there,

"Cashdeskmac" 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.Redirect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redirect("WebForm.aspx", 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.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
Line 21: private void Page_Load(object sender, System.EventArgs e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
Source File: c:\inetpub\wwwroot\webapplication2\webform.aspx.cs Line: 23

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
WebApplication2.WebForm.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\webapplication2\webform.aspx.cs :23
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BC**********************************@microsof t.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.Redirect
it works fine, and so I assume that there is a problem with the settings on
my machine.

"Juan T. Llibre" wrote:

Both Response.Redirect 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/
===================================
"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:BD**********************************@microsof t.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.Redirect 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*********@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.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

P: n/a
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 <sessionStateof 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

"cashdeskmac" 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.Redirect 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.Redirect" code in (as
stated in both responses), sessions state is not maintained?
Don't use Response.Redirect.
Use Server.Execute *instead* of using Response.Redirect.

re:
But if I place the appropriate "Response.Redirect" 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***@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.com...
Hi there,
>
"Cashdeskmac" 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.Redirect" code in (as
stated in both responses), sessions state is not maintained?
For example, if the following code is entered is the following:
Response.Redirect("WebForm.aspx", 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.NullReferenceException: Object reference not set
to an instance of an object.
>
Source Error:
>
>
Line 21: private void Page_Load(object sender, System.EventArgs e)
Line 22: {
Line 23: Label1.Text = "Your name is " + Session["Name"].ToString();
Line 24: }
Line 25:
>
>
Source File: c:\inetpub\wwwroot\webapplication2\webform.aspx.cs Line: 23
>
Stack Trace:
>
>
[NullReferenceException: Object reference not set to an instance of an
object.]
WebApplication2.WebForm.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\webapplication2\webform.aspx.cs :23
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
>
>
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/
>===================================
>"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
>news:BC**********************************@microso ft.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.Redirect
it works fine, and so I assume that there is a problem with the settings on
my machine.
>
"Juan T. Llibre" wrote:
>
>Both Response.Redirect 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/
>===================================
>"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
>news:BD**********************************@microso ft.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.Redirect 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*********@discussions.microsoft.comwrote in message
>news:A7**********************************@microso ft.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 discussion thread is closed

Replies have been disabled for this discussion.