I would like to remove the last segment of Request.Url, so for instance…
http://www.example.com/admin/users.aspx/deleteUser
would change to
http://www.example.com/admin/users.aspx
I would prefer linq but accept any solution that efficiently works.
Use the
Uriclass to parse the URI – you can access all the segments using theSegmentsproperty and rebuild the URI without the last segment.As an alternative to getting the scheme and host name, as suggested by Dour High Arch in his comment: