How do you encode a string to use in a URI
Posted: Tue Aug 04, 2015 5:06 pm
Hello support and fellow forum users,
I am looking for a way to encode a string into a URI friendly format. I tried to use System.Web.HttpServerUtility.UrlEncode, but that method doesn't exist even though it's been available since .NET 2.0. I vaguely remember reading that we could use any library available in .NET.
I've also tried to use WebUtility.UrlEncode(), but I keep getting the following error message even though Ranorex Studio auto completes the method as I am typing it in:
"The name 'WebUtility' does not exist in the current context"
Here's an example of what I would like to do:
Given string: [email protected]&mvVar=Some Value
Expected string: myemail%40domain.com&mvVar=Some%20Value
Setup Info:
Ranorex Version: 5.4.0.24580
.NET Runtime Version: 4.0.30319.34014
Thanks in advance!
I am looking for a way to encode a string into a URI friendly format. I tried to use System.Web.HttpServerUtility.UrlEncode, but that method doesn't exist even though it's been available since .NET 2.0. I vaguely remember reading that we could use any library available in .NET.
I've also tried to use WebUtility.UrlEncode(), but I keep getting the following error message even though Ranorex Studio auto completes the method as I am typing it in:
"The name 'WebUtility' does not exist in the current context"
Here's an example of what I would like to do:
Given string: [email protected]&mvVar=Some Value
Expected string: myemail%40domain.com&mvVar=Some%20Value
Setup Info:
Ranorex Version: 5.4.0.24580
.NET Runtime Version: 4.0.30319.34014
Thanks in advance!