Asp.net Get and Post parameters, and asp.net Parameters

Source: Internet
Author: User

Asp.net Get and Post parameters, and asp.net Parameters

Asp.net Get and Post Parameters

 

Get request:

For parameter passing: test. aspx? Name = % e5 % bc % a0 % e4 % b8 % 89

Method for receiving parameters:

Request. QueryString ["name"]

HttpContext. Current. Request ["name"]

The parameters received by both are "Zhang San"

The two decode parameters when receiving them: HttpUtility. UrlDecode

Post request:

Method for receiving parameters:

Request. Form ["name"]

HttpContext. Current. Request ["name"]

The two parameters are decoded by default: HttpUtility. UrlDecode

 

If you want to upload special characters, such as + and &, You need to perform the encoding operation: HttpUtility. UrlEncode.

 

For example, you need to transmit a + B & c correctly.

String name = string. Format ("name = {0}", HttpUtility. UrlEncode ("a + B & c "));

...

Request. QueryString ["name"]

Request. Form ["name"]

HttpContext. Current. Request ["name"]

These parameters are decoded by default when they are received.

 

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.