"Fortunate are those who take the first steps.” ― Paulo Coelho

Pass Variables Between ASP.NET Pages ??

Pass Variables Between ASP.NET Pages

Pass variables between ASP.NET pages as part of a query string in the URL. If your form is not running at server you can also use the Request object to retrieve the values of the form elements (especially hidden input elements for this purpose). However, if you have a form with runat=server, and you don’t want to expose the variables to the user then your choices are limited. Here is a way to pass variables between ASP.NET pages:

1. In your first.aspx add an item to the context.

  Context.Items.Add("m1", firstname.text)
  Context.Items.Add("m2", lastname.text)   

2. In your first.aspx call Server.Transfer to transfer to your secondpage.aspx.

  Server.Transfer("secondpage.aspx", True)

3. In your secondpage.aspx retrieve the variable from the context.
  Dim receivedValue As String

  localtext1.text = Context.Items("m1")
  localtext2.text = Context.Items("m2") 


content :original

Thnks to sathees for rising this question


March 14, 2005 - Posted by | ASP.NET >>

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: