Asp. NET state Management bis (query Word fu string querystring)

Source: Internet
Author: User
Tags urlencode

Query Word Fu string is appended to the URL after the data (also I often used)

For example:

Http://www.cnblogs.com/aierong/admin/EditPosts.aspx?opt=abc

Over here? After the opt=1 is the query string

This method can be used when we pass data to another page on one page.

You receive data by using the following methods:

String str=request.querystring["opt"]

So str equals "ABC."

Here we are passing the English characters, if we pass Chinese characters, we have to encode and reconcile it:

When sending, use the Server.URLEncode method to encode, receive time to use Server.urldecode to solve the password.

For example:

Passed:

String Url= "http://www.cnblogs.com/aierong/admin/EditPosts.aspx?opt=" +server.urlencode ("we");

Response.Redirect (URL);

Receive:

String Str=server.urldecode (request.querystring["opt"]);

So str equals "we."

Of course, we still have a convenient way:

Modify the globalization section in Web.config to

<globalization
requestencoding= "gb2312"
responseencoding= "gb2312"
/>

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.