If you place a debug break on the Request.Url you can see all the items that can give you , like the .Path and can do the job. Is faster than make a question.
Always the first three parts or remove the "reportview.aspx"? Or to put it in a different way, what if the url is http://localhost/portal/sub/page.aspx?
.Pathand can do the job. Is faster than make a question.http://localhost/portal/sub/page.aspx?