The documentation says:
<DOCUMENTATION>
Summary
Gets a Boolean value that indicates whether the URI information used to
construct the current instance was escaped before the current instance
was created.
Property Value
true if the dontEscape parameter of the constructor for the current
instance was set to true ; otherwise, false.
</DOCUMENTATION>
I understood it as, if the Uri specified as the argument in the
constructor of this class is already URLEncoded, then this property is
set to True, and otherwise to false. So, I tried this code:
<CODE>
try
{
u = new Uri("http%3A%2F%2Fwww%2Esathyaish%2Ecom");
}
catch(Exception e)
{
Console.WriteLine(e.Message);
return;
}
Console.WriteLine("\nUserEscaped: " + u.UserEscaped);
</CODE>
I also tried two other URLs given below (not URL Encoded this time):
1. http://www.yahoo.com
2. http://discuss.joelonsoftware.com/?joel
The property always returns False. What's the deal?
// here the uri is already encoded (using %20), hence dont ask uri to
put escape chars
// if you dont pass true, it is false by default. hence userescaped
will return false
Uri u2 = new Uri("http://www.somesite.com/some%20page.htm", true);
Console.WriteLine(u2.UserEscaped);
Console.WriteLine(u2.ToString());
HTH
Kalpesh