Re: Session variables problem

From: Prodip Saha (psaha_at_bear.com)
Date: 12/01/04


Date: Wed, 1 Dec 2004 11:03:52 -0600

One of the alternative architechture you can consider is - exposing public [shared] properties on the First page (where the search button located) and call them from the second page. In ASP.NET every form assocaited with a class and it can be called from any other classes. This way we don't have to use query string like we had to use in asp applications.

Take a look at this link - http://authors.aspalliance.com/aspxtreme/webapps/passingcontrolvaluesbetweenpages.aspx

Problem with this approach: when you want to come back to search page what criteria do you bring back from second page to first page? One way to accomplish this is - exposing public [shared] properties on second page and call them from the first page.

Microsoft also has documentation on this but I could not find it find handy. Hope this help.

Prodip Saha

"Simon Matthews" <SimonMatthews@discussions.microsoft.com> wrote in message news:A935A4AB-6BF9-436A-9C24-C68BF625F179@microsoft.com...
> I am having issues with the right way to architecture the following (using c#
> asp.net):-
>
> The question I have is how best pass the collected data from one web page
> for use in another.
>
> The question I have is how best pass the search criteria from the first page
> to the second. The search criteria exists as a structure and is filled when
> the user presses the 'Search' button on the first page.
>
> 1. Present an asp page for collecting user search criteria
> 2. Show grid with results of search after querying SQL
>
>
>
> If I use the session to store it, then this causes problems as the session
> variable is overwritten on a second search by the user, but a couple of
> presses on the back button of the browser will get you to a page expecting
> different criteria in the session from earlier which is no longer there.
>
> ViewState seems no good as it only works on postback and the above issue
> would still cause a problem.
>
> I do not want to pass the search criteria in the address line as this is
> messy and allows the user to change and view it.
>
> I beleive you can also use Server.Transfer but I think this would have a
> similiar issue with the data being available long-term.
>
> Any pointers as to the correct approach to this would be most welcome.