Newbie question: session state:

  • Thread starter Thread starter Matt C.
  • Start date Start date
M

Matt C.

I am fairly new to ASP.NET so please forgive errors in terminology.

I am using the CrystalReportsViewer control to display report data over the
web. Data is posted to the .aspx page from a different form on a standard
..html page. (I know ASP.NET likes to use postback to get form data, but I
decided not to do that here.)

The first page of the report loads fine, looks pretty, we're very happy, but
when I try to browse to the another page, I get an error (string reference
not set to an instance of String). I am 99% certain that this error occurs
because the form data from the original .html page is getting dropped.

My first inclination is to just stick that original form data into Session
variables, and recode so that the report params are pulling from those
Session variables instead of the original .html form variables. I'm pretty
sure this will work, and doesn't seem ugly to me.

But, I also know there is all sorts of fancy stuff in ASP.NET to manage
persistence, and maybe there is a better or cleaner way. Any suggestions?

Thanks,
Matt
 
Instead of being 99% sure, why don't you set a breakpoint and make 100% sure
where and what the error is?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.
 
Well, I'm glad you identified the problem. Using Session is tricky, however,
as Sessions time out. How are you transferring to the next page? You might
be able to pass the document through using Server.Transfer to transfer to
the next page, but before transferring, add the document to the HttpContext
of the current page. Then you can grab it out of the context in the next.
And you don't have to worry about Session time-outs.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.
 
Back
Top