Passing Values from Page to Page

gdboling

Member
Joined
Jul 11, 2003
Messages
12
Location
Wichita, KS
While learning how to do this in ASP.NET I ran across several different solutions.

Server.Transfer
Request.QueryString
Request.Param
Session[]

Is there a BEST method to use, or does it always depend on the context of the web app?

Thanks.

Gregg

PS. The only one I could ever get to work right was when using Server.Transfer which seems like a pretty good method anyway.
 
There is NO BEST method.

Example:
You can "transfer" any String or Integer to another side with Request.Querysting, but you cant transfer by this way whole objects... Therefore it gives e.g. session, but these get timeouts (standard after few minutes [web.config])

Security:
In Request.QueryString you have no security, the user can change its value...

You see, conditional what you want to do...

Regards
 
But with what you just said, then there may be a best method if you take into account security and being able to pass objects around. And I would assume that keeping with the same passing method throughout the web app would be preferred?
 
Not necessarily... You could use a Session variable to store a
users logged-in ID instead of a QueryString (which they could
easily change), but use QueryStrings if you just want to pass
parameters to a page on how to sort data (so that when the
URL was copied and pasted, the sorting would be sustained).

Also keep in mind that Session variables are stored on the server,
and a whole bunch of them could take a toll on the servers
memory.

Dont forget about cookies for storing data, too.
 
Back
Top