Simon
Simon

Reputation: 1653

Adding an unescaped query parameter in C#

I am trying to add an unescaped parameter to a URL with the help of UriBuilder. How can I prevent the characters of the parameter to be escaped?

query.Set("oauth_signature", CONSUMER_SECRET + "%26");
builder.Query = query.ToString();

The resulting URL always contains % as an escaped sequence as the oauth_signature value (which is %25 apparently).

Upvotes: 0

Views: 404

Answers (2)

Kieren Johnstone
Kieren Johnstone

Reputation: 41993

A dirty workaround would be to use a token to identify where the parameter should go in, and string.Replace it afterwards. It's not safe though, which is probably why there's no easy way with UriBuilder.

Upvotes: 0

DoctorMick
DoctorMick

Reputation: 6793

%26 is & right? Why not just do

query.Set("oaut_signature", CONSUMER_SECRET + "&");

Upvotes: 1

Related Questions