A little view of encode operation on the query field

Source: Internet
Author: User
Tags urlencode
Encode the query field for encode operations:
The use of a query field to pass information between different home pages must be encode (note that there is a different page pass), because if you do not, you are likely to get the recipient of the message to receive some strange string that you do not expect.
Note: In fact, if there are no special characters in the query field, such as spaces and punctuation, you can also do without encode operations.
In fact, this encode operation is very easy, there is a specific way to perform this operation: that is the Server.URLEncode () method, look at the following example:
<a href= "Response.asp? Message=<%=server.urlencode ("This Query String has been URL encoded.") %> "> Click here </a>

Please note: Do not encode the name of the query field and the equal sign, just encode the value.

After the encode operation, the query field is as follows:
message=this+query+string+has+been+url+encoded%2e

There is no need to consider decoding the string above, which is handled automatically by the Active Server page. For example, suppose you have such a script in response.asp:
<%=request.querystring ("message")%>
At this point, the result is:
This Query String has been URL encoded.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.