user240141
user240141

Reputation:

How to replace %20 with - in Url Rewriting

I am using UrlRewritingNet.UrlRewriter.dll for url rewriting purpose and frankly, I am new to this stuff. My problem is that , i want to replace %20 in my url with -.

Upvotes: 3

Views: 5049

Answers (3)

Ali Hasan
Ali Hasan

Reputation: 1075

or you can put the url in a string then use

string urla = "your url";
string urlb = url.Replace("%20", "-");

Upvotes: 0

Alexander Galkin
Alexander Galkin

Reputation: 12534

If you need a custom replace apart that HttpUtility gives you (in this case it will convert it to space!) then just use string replacement.

Uri myuri = new Uri(myolduri.ToString().Replace("%20","-"));

Upvotes: 2

scottm
scottm

Reputation: 28701

HttpUtility.UrlDecode() does what you need.

Upvotes: 5

Related Questions