Asp. NET tips: URL encoding processing

Source: Internet
Author: User
Tags tostring urlencode
Asp.net| Code | tips

Issues to resolve:
Upload the following URL as a parameter to the other page
1 http://domain/de.apx?uid=12&page=15
2 after the URL in the parameters of the Chinese characters, such as: .... aspx?title= Crane
In the case of the above, you must go through a rul encoding and decoding process, otherwise there will be an error.
The code is as follows:

1//Pass Value
2string temp = "<a href= ' add.aspx?url=" +server.urlencode (skin. Page.Request.Url.AbsoluteUri) + "&title=" +server.urlencode (skin. Page.Header.Title) + "' > Add to Favorites </a>");
3
4//the value from above in a different file
5if (request.querystring["url"]!= null)
6 {
7 String url = Server.urldecode (request.querystring["url"). ToString ());
8 this.txtAddress.Text = URL;
9}
Ten if (request.querystring["title"]!= null)
11 {
The string title = Server.urldecode (request.querystring["title"). ToString ());
This.txtTitle.Text = title;
14}



Related Article

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.