The plus sign in querystring is missing.

Source: Internet
Author: User

The current project uses the clickonce technology to deploy the client. The client sometimes needs to transmit some parameters from the server, for programs deployed in clickonce, we can use query strings in the launch URL to achieve this goal. Refer to the article on msdn and soon the code is finished. Okay. Try it. Deployment, from the launch client of the server, everything seems to be normal, and the value of all parameters has been successful.

But before waiting for the check-in code, a test fails. After debugging, it took only half a day to find that it was another plus sign in a parameter value: +. After using httputility. parsequerystring to analyze the query string, the plus sign in the parameter value becomes a space, which does not seem to have been encountered before. Google knows that the original plus signs are reserved in the query string to represent spaces. To pass these reserved characters in the query string, the query string must be encoded.

I modified the server code and added the decode method on the client. I didn't expect the result to be wrong. After checking the msdn help for the httputility. parsequerystring method, we can see that the original method will decode the query string and return the namevaluecollection containing the result.

After half a day, I finally got it done.

 

Summary:

1) for security reasons, query string must be encode

2) httputility. parsequerystring automatically performs decode.

 

Happy coding!

~ Crazy

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.