Retrieving Session Variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a page which contains a number of link buttons. I have registered a CommandEventHandler with the link button. In this event handler I want to set a session variable equal to the text of the button clicked, I then want to redirect the user to a new page within my application. This new page will check for a session variable previously set and display its contents

For some reason when I go to retrieve the session variable it is always null...? Anyone know why, am i missing something, my code is below

Page 1 code..

if( link.Text != null

Session.Add( "TopBarText", link.Text )


Response.Redirect( link.CommandName )

Page 2 code - this is always null

if( Session["TopBarText"] != null

descriptionCell.Text = Session["TopBarText"].ToString()
 
Back
Top