For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > October 2004 > How to get directory path of current rquest?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to get directory path of current rquest?
Olav Tollefsen

2004-10-29, 3:58 pm

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


Scott Mitchell [MVP]

2004-10-29, 3:58 pm

Olav Tollefsen wrote:
> 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
mitchell@4guysfromrolla.com
http://www.4GuysFromRolla.com

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







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com