20140115-url encoding and decoding

Source: Internet
Author: User

    1. UrlEncode () method, there are two classes that have this method, namely Httputility.urlencode and Server.URLEncode

Difference:

1, Httputility.urlencode,httputility.urldecode is a static method, and Server.urlencode,server.urldecode is an instance method.

2. Server is an instance of the HttpServerUtility class, and is the attribute of System.Web.UI.Page.
3. Httputility.urlencode encoded strings and string objects encoded with Server.URLEncode are not the same?

4. Server.URLEncode can be encoded according to your page's defined encoding. and? Httputility.urldecode is encoded by default in UTF8. Otherwise you'll need to specify your own encoding method:

(ref:http://www.cnblogs.com/akak123/archive/2012/06/13/2547790.html)

    1. Function: URL-encodes a string and returns the encoded string.

      Note: International general, prevent garbled. Corresponding to this is the urldecode operation.

      The content to encode is not necessarily a URL, but a string in essence

    2. Where to use it now:
      1. When you complete the file download requirement, Httputility.urlencode
      2. When writing data to a cookie, Server.URLEncode and Server.urldecode

20140115-url encoding and decoding

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.