Pirson
Pirson

Reputation: 75

Decoding Querystring

I have this url-link : http://localhost:50201/CastingForms/CastingList.aspx?name=<a>.

How can I get parameter name.

For now I use this code sname = Request.QueryString["name"];

But it returns ""(empty result).

I used System.Web.HttpUtility.HtmlEncode to encode name.

Upvotes: 0

Views: 197

Answers (2)

Pirson
Pirson

Reputation: 75

To redirect new url; I did not encode the html tag. I encode on other page. I transfer as string (http://localhost:50201/CastingForms/CastingList.aspx?name=<a>)

I make some changes in web-config file.

<httpRuntime targetFramework="4.5" executionTimeout="100000" maxRequestLength="214748364" requestValidationMode="2.0" />
<pages validateRequest="false">

Upvotes: 1

Joseph Bisaillon
Joseph Bisaillon

Reputation: 173

Without knowing what version of Net. Here is a possible solution.

  var queryValues = Request.RequestUri.ParseQueryString();

Then just access query values like a Dictionary collection.

Upvotes: 2

Related Questions