I want to pass a few variables to another page. Currently I'm using response.redirect and passing the variables in the url. I'm not really interested in using Session Variables. Is there a way to pass hidden variables in .NET to a completely different form?
You can use
Server.Transfer("Your transfer page url")
server.transfer will transfer all variable of current page to another transfered page.
(You can also use Server.Transfer() and not loose the Request.Form data.)
There are basically three ways of passing data to the next page:
In the query string
This is limited to the size of the URL that the browser can handle, about 1000 characters is considered safe.
In form data
This requires you to post a form instead of using
Response.Redirect
. You can put hidden fields in the page. The values thus are not completely hidden, as they can bee seen in the page source, and they are sent in the request although not immediately visible as in the URL.In session variables
This doesn't send the data directly, instead only the session id is sent in the request (as a cookie), the session variables never leave the server.
There is a slight difference between the methods that applies when the user has more than one window open showing pages from your site. In the first two methods each window has it's own set of data, but using the third method means that all windows uses the same data.
You could try cookies, but you can still see what those are if you look and its not very reliable. I would go with session variables, like in Syed's example.