About handling parameters with special characters submitted by Get method

Source: Internet
Author: User
Once a friend encountered such a problem, a product name is A&t Plastic, in the product list produces such a join <a href= "product.asp?name=a&t Plastic" >a&t PLASTIC&LT;/A&GT, you cannot receive the exact product name when you receive this parameter on the server side.
Asked me at that time, how to solve, perhaps was busy at that time, casually told him to use the HTMLEncode method, the other side tried to tell and did not solve the problem. I did not give an answer at that time, occasionally think of is really sorry, I said wrong. Today's leisure to tidy up how to deal with get way submitted by the parameters containing special characters, to the table heart guilt.
The meaning of special special characters
————————————————————————————
Meaning URL encoding for character special characters
# used to flag a specific document location%23
% to encode special characters%25
& separating different values of variables to%26
+ denotes a space in the value of a variable%2b
Represents a directory path%2f
= used to connect keys and values%3d
? Represents the start of a query string%3f
When a key value contains some of the characters in the above list, the value cannot be received accurately.
<!--file name is 01.asp-->
<%
' Defines a string containing special characters
Str= "Parameter=#%&+=?value
' Encode using the UrlEncode method
Strurlencode=server. UrlEncode (str)

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.