Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok, I have a session variable called "CheckType". I have it in my global.aspx

blanked out:

 

Session("CheckType") = ""

 

I then have a page where I assign a value to it:

 

Session("CheckType") = "DIRECT"

 

I then do a Response.redirect onto another page. Then I try to reference the value of the session variable:

 

If Session("CheckType") = "DIRECT" then.....

 

It is always blank. Should I not have it in global.aspx?

Posted

Where in the global.asax are you setting the value to blank? Make sure it is not being overwritten with every page load.

 

Put a breakpoint on the Response.Redirect and check the contents of the Session variable right before you actually redirect.

Posted
Ok, I have a session variable called "CheckType". I have it in my global.aspx

blanked out:

 

Session("CheckType") = ""

 

I then have a page where I assign a value to it:

 

Session("CheckType") = "DIRECT"

 

I then do a Response.redirect onto another page. Then I try to reference the value of the session variable:

 

If Session("CheckType") = "DIRECT" then.....

 

It is always blank. Should I not have it in global.aspx?

 

Take it out of your global.asax. I think you are confusing application variables with session variables.

 

A session variable, a cache variable, and a viewstate variable can be assigned or called from within any page in your application, just make sure you are using the correct one for what you are trying to accomplish.

 

Also, if you are still having problems with your session variable, make sure your settings are correct in your web.config file and that you aren't timing out.

 

Good Luck,

Brian

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...