QueryString in asp.net Part 59

  • دعنا نشارك هذا :
ترتيب الدرس : 59
المدة : 00:13:56
التحكم :
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.


All ASP .NET Text Articles

All ASP .NET Slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

Different techniques to move data from one webform to another
1. Cross Page Postback: Discussed in Part 55 and Part 56
2. Context.Handler object - Discussed in Part 58
3. Query strings - Will be discussed in this session.

The following concepts will be discussed in the subsequent sessions
4. Cookies
5. Session state
6. Application state

Points to remember about query strings
1. Querystrings are name/value collection pairs
2. Using querystrings, is a very comman way to send data from one webform to another.
3. Query strings are appended to the page URL.
4. ?(Question Mark), indicates the beginning of a query string and it's value.
5. It is possible to use more than one query string. The first query string is specified using the ?(question mark). Subsequent query strings can be appended to the URL using the &(ampersand) symbol.
6. There is a limit on the Query string length. Hence, Query strings cannot be used to send very long data.
7. Query strings are visible to the user, hence should not be used to send sensitive information, unless encrypted.
8. To read the query string value, use Request object's QueryString property.
9. &(ampersand) is used to concatenate query strings, so if you want to send &, as value for the query string there are 2 ways, as shown below
Using Server.UrlEncode() method
Response.Redirect("WebForm2.aspx?UserName" + Server.UrlEncode(txtName.Text) +
"&UserEmail" + Server.UrlEncode(txtEmail.Text));

&(ampersand) is encoded as %26, so use, Replace() function to replace & with %26
Response.Redirect("WebForm2.aspx?UserName" + txtName.Text.Replace("&", "%26") +
"&UserEmail" + txtEmail.Text.Replace("&", "%26"));

سيتم تفعيل التعليقات قريبا

Sep 23, 2020 07:32:24