

HOW TO PASS VALUE FROM ONE PAGE TO ANOTHER IN PHP MAKER CODE
The following code example shows a property named CurrentCity that exposes the value of a TextBox control named textCity.

On the source page, create one or more public properties and save the page.

To get public property values from the source page If the source page and target page are both ASP.NET Web pages in the same Web application, and if you transfer execution from the source page to the target page on the server by using the Transfer method, the target page can access public properties in the source page. Getting Public Property Values from the Source Page In the target page, read the saved information from session state, as shown in the following example: Dim field1 as String = CType(Session.Item("field1"), String) In the source page, save the information that you want to pass in session state, as shown in the following example: Session("field1") = "value1" For more information, see How to: Save Values in Session State and How to: Read Values from Session State. However, session state takes server memory, and the information is stored until the session expires, which can be more overhead than you want for simply passing information to the next page. Information in session state is available to all ASP.NET Web pages in the current application. Void Page_Load(object sender, EventArgs e) Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _ĭim postedValues As NameValueCollection = Request.Formįor i As Integer = 0 To - 1 The following code example excludes the values of posted fields that are named with a leading double underscore (_). Post information from an ASP.NET Web pages includes the values of hidden fields, such as _VIEWSTATE, _EVENTTARGET, and _EVENTARGUMENT, which are used for internal processing in the page. The following code example displays the ID and value of every posted control in the source page and displays the posted values in a label named Label1. In the target page, read the Form collection, which returns a dictionary of name/value pairs, one pair for each posted value. In the source page, include a form element that contains HTML elements (such as input or textarea) or ASP.NET server controls (such as TextBox or DropDownList controls) that post values when the form is submitted. To get the values of controls from the source page in another application Although posted values are not as readily available to users as query strings are, they can be viewed and changed using commonly available browser tools. Security Note:ĭo not pass sensitive data in posted values. Note that you can get only the post values you cannot read the values of arbitrary controls on the page. When the source page uses the HTTP POST action to navigate to the target page, you can retrieve posted values from the Form collection in the target page. Getting Post Information from the Source Page In the target page, access query string values by using the QueryString property of the HttpRequest object, as shown in the following example: Dim s As String The first pair is preceded by a question mark (?) and subsequent pairs are preceded by ampersands(&), as shown in the following example: In the source page when you specify the URL of the target page, include the information that you want to pass in the form of key-value pairs at the end of the URL. To use a query string to pass information Never pass sensitive data using a query string, because the information is visible to users and can easily be modified, thus representing a potential security risk.įor more information, see QueryString.
