Reputation: 634
I've been using the HttpRequest
class in some legacy code, and I've seen that sometimes the path part is obtained using HttpRequest.Path
and some other times using HttpRequest.Uri.AbsolutePath
.
I personally don't see any difference between both, but maybe I'm missing something.
Are the results of HttpRequest.Path
and HttpRequest.Uri.AbsolutePath
always 100% equivalent?
Upvotes: 0
Views: 3393
Reputation: 38087
Looking at the Reference Source for the Uri, it is built using the Path, so they should be equivalent:
_url = BuildUrl(() => Path);
Upvotes: 1
Reputation: 4274
Yes, they should
http://msdn.microsoft.com/en-us/library/system.web.httprequest.path(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/system.uri.absolutepath(v=vs.110).aspx
The HttpRequest.Path returns an absolute path
Upvotes: 1
Reputation: 11
Yes. They are one and the same. I just run a couple of quick tests and found that the they both are the same. Some research over it showed me that, httprequest.path is an virtual path to the current request which should be exactly the same as absolute path of the URI from that request.
Upvotes: 1