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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Feb 5, 2013, 2:35 AM EST
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
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 5, 2013, 2:49 AM EST
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.
mohit ranjan49 reputationPosted Feb 5, 2013, 2:52 AM EST