If the URL that arrives to ASP.NET application contains trailing full stops - '.', they are truncated from the Url property in HttpRequest.
For example if the URL is "http://server/folder.../", the following call:
HttpContext.Current.Request.Url.PathAndQuery;
returns "/folder/" instead of "/folder.../".
Tried this solution, but it helps only if the Uri is constructed after the suggested code executes, while HttpRequest is probably constructed before any code in ASP.NET web application is executed.
Any ideas how to preserve trailing '.' in HttpRequest.Url?
You can add the
relaxedUrlToFileSystemMapping
to your web.config inside<system.web>
section.This will preserve the dots in the url.
But for some reason
Url.PathAndQuery
wont contain the dots, while RawUrl contains them.Keep in mind that there are probably some security implications when enabling
relaxedUrlToFileSystemMapping
.