Uri baseUri = new Uri("http://abc.com/DELHI/CENTRAL_DELHI/A.");
i have the url ending with (.) or dot
but this class remove the (.) from the end of url.
i want that dot in url please give solution its urgent
thanks in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Santhosh Kumar JayaramanPosted Feb 5, 2013, 7:35 AM
MethodInfo getSyntax = typeof(UriParser).GetMethod("GetSyntax", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
FieldInfo flagsField = typeof(UriParser).GetField("m_Flags", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
if (getSyntax != null && flagsField != null)
{
foreach (string scheme in new[] { "http", "https" })
{
UriParser parser = (UriParser)getSyntax.Invoke(null, new object[] { scheme });
if (parser != null)
{
int flagsValue = (int)flagsField.GetValue(parser);
// Clear the CanonicalizeAsFilePath attribute
if ((flagsValue & 0x1000000) != 0)
flagsField.SetValue(parser, flagsValue & ~0x1000000);
}
}
}
Now add your uri in the next line
Uri baseUri = new Uri("http://abc.com/DELHI/CENTRAL_DELHI/A.");
Check this
http://stackoverflow.com/questions/856885/httpwebrequest-to-url-with-dot-at-the-end
mohit ranjanPosted Feb 5, 2013, 7:52 AM
Jignesh TrivediPosted Feb 5, 2013, 7:49 AM
As I understand RFC2396 '.' are not valid characters in a URI.
The RFC 2396 says in Chapter 2.3. Unreserved Characters:
unreserved = alphanum | mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
Please refer
http://msdn.microsoft.com/en-US/library/system.uri.escapedatastring.aspx
http://www.ietf.org/rfc/rfc2396.txt
hope this will help you.