Given the name of a virtual directory I need to get the name of the physical
directory (programmatically) ? I am running a .NET C# application. Any
ideas ?

Thanks,

RM.

Re: Obtain physical Directory by Ken

Ken
Sat Feb 05 01:35:33 CST 2005

HTTPRequest.Mappath()

Cheers
Ken

"RM" <darasingha_nospam@yahoo.com> wrote in message
news:%23G$IQ1xCFHA.464@TK2MSFTNGP15.phx.gbl...
> Given the name of a virtual directory I need to get the name of the
> physical
> directory (programmatically) ? I am running a .NET C# application. Any
> ideas ?
>
> Thanks,
>
> RM.
>
>



Re: Obtain physical Directory by Kristofer

Kristofer
Sat Feb 05 02:26:40 CST 2005

Hi,

Ken is correct, although it is case-sensitive in C# :-)

Here's a link to the MSDN documentation:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttprequestclassmappathtopic.asp

--
Regards,
Kristofer Gafvert
www.gafvert.info - My Articles and help
www.ilopia.com


RM wrote:

> Given the name of a virtual directory I need to get the name of the
physical
> directory (programmatically) ? I am running a .NET C# application. Any
> ideas ?
>
> Thanks,
>
> RM.

Re: Obtain physical Directory by RM

RM
Sun Feb 06 21:48:38 CST 2005

Thans. But does that work if I am not fielding an HTTP request ? My
application is called from the installer before the ASP.NET application is
actually installed and running.


"Kristofer Gafvert" <kgafvert@NEWSilopia.com> wrote in message
news:xn0dy517998c2uo017@news.microsoft.com...
> Hi,
>
> Ken is correct, although it is case-sensitive in C# :-)
>
> Here's a link to the MSDN documentation:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttprequestclassmappathtopic.asp
>
> --
> Regards,
> Kristofer Gafvert
> www.gafvert.info - My Articles and help
> www.ilopia.com
>
>
> RM wrote:
>
>> Given the name of a virtual directory I need to get the name of the
> physical
>> directory (programmatically) ? I am running a .NET C# application. Any
>> ideas ?
>>
>> Thanks,
>>
>> RM.



Re: Obtain physical Directory by Kristofer

Kristofer
Mon Feb 07 07:15:54 CST 2005

Hi,

The metabase is structured hiearchially, and as far as i know, you cannot
query the path directly. (you cannot find the virtual directory).

So you need to loop thru all contents beneth IIS:// MachineName/W3SVC/
N/ROOT and check if it is the Virtual Directory you are looking for. Once
you have found the Virtual Directory (a IIsWebVirtualDir), you can get the
Path property of it, and that is the physical folder on the file system.

IIsWebVirtualDir:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/e6267811-028e-4508-aec9-b99a4b7d9547.asp

Path:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/2189c272-7eb3-4c7d-8838-02e860c013b1.asp

If you dont already have Metabase Explorer, i can recommend you to
download and install it. It will be much clearer how the IIS Metabase is
structured.


Metabase Explorer 1.6
http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499&DisplayLang=en

Yes, Metabase Explorer available in the IIS 6.0 Resource Kit works on XP
if you have that as a development/testing machine.

Hope this helps you write this code.

--
Regards,
Kristofer Gafvert
www.gafvert.info - My Articles and help
www.ilopia.com


RM wrote:

> Thans. But does that work if I am not fielding an HTTP request ? My
> application is called from the installer before the ASP.NET application
is
> actually installed and running.
>
>
> "Kristofer Gafvert" <kgafvert@NEWSilopia.com> wrote in message
> news:xn0dy517998c2uo017@news.microsoft.com...
> > Hi,
> >
> > Ken is correct, although it is case-sensitive in C# :-)
> >
> > Here's a link to the MSDN documentation:
> >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttprequestclassmappathtopic.asp
> >
> > --
> > Regards,
> > Kristofer Gafvert
> > www.gafvert.info - My Articles and help
> > www.ilopia.com
> >
> >
> > RM wrote:
> >
> >> Given the name of a virtual directory I need to get the name of the
> > physical
> >> directory (programmatically) ? I am running a .NET C# application.
Any
> >> ideas ?
> > >
> >> Thanks,
> > >
> >> RM.