How to get directory path of current rquest?

S

Scott Mitchell [MVP]

Olav said:
I have looked at the various attributes of the HttpRequest class, but I
didn't find an attribute to return the directory path to the current
request.

Given the URL Http://www.contoso.com/virdir/page.html, I would like to have
a method to return:

Http://www.contoso.com/virdir/

Does anyone know how to achieve this?

Olav, check out this blog entry from Rick Strahl -
http://west-wind.com/weblog/posts/269.aspx

This blog entry should be in everyone's bookmarks, as it's probably the
best place to go to find out about determining path information in
ASP.NET. He has some code posted in that entry that does precisely what
you are looking for.

Happy Programming!

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top