Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Getting IIS Code base directory

 
   Web Hosting Problem Solving Community! (Home) -> IIS RSS
Next:  Prefill Security dialog for Basic Authentication  
Author Message
Pankaj

External


Since: Feb 07, 2005
Posts: 2



(Msg. 1) Posted: Mon Feb 07, 2005 3:57 pm
Post subject: Getting IIS Code base directory
Archived from groups: microsoft>public>inetserver>iis (more info?)

Hi,
I'm in the situation where I want to get the absolute path of IIS code base
directory (i.e. typically <website name>\bin ), without passing the website
(virtual directory) name.

As the default current directory (or working directory) for the IIS is
"C:\WINNT\system32\inetsrv", the "Directory.GetCurrentDirectory()" method
always returns "C:\WINNT\system32\inetsrv" and not the path where actual
binary files of the website are residing.

Can anybody help me by telling how do I get the absolute path of the
directory "without passing the website name" ?

Thanks in advance
Pankaj A. Chitriv

 >> Stay informed about: Getting IIS Code base directory 
Back to top
Login to vote
Grzegorz Kaczor

External


Since: Feb 08, 2005
Posts: 3



(Msg. 2) Posted: Tue Feb 08, 2005 8:35 am
Post subject: Re: Getting IIS Code base directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Pankaj wrote:
 > I'm in the situation where I want to get the absolute path of IIS code base
 > directory (i.e. typically <website name>\bin ), without passing the website
 > (virtual directory) name.
 >
 > As the default current directory (or working directory) for the IIS is
 > "C:\WINNT\system32\inetsrv", the "Directory.GetCurrentDirectory()" method
 > always returns "C:\WINNT\system32\inetsrv" and not the path where actual
 > binary files of the website are residing.
 >
 > Can anybody help me by telling how do I get the absolute path of the
 > directory "without passing the website name" ?

If it is ASP.NET, try Request.Path / Request.PhysicalPath.

Regards,
G.Kaczor<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Getting IIS Code base directory 
Back to top
Login to vote
kgafvert

External


Since: Aug 23, 2003
Posts: 3146



(Msg. 3) Posted: Tue Feb 08, 2005 10:41 am
Post subject: Re: Getting IIS Code base directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi,

I think that what you are looking for is the HttpRequest.MapPath method

Here's a link to the MSDN documentation:

<a style='text-decoration: underline;' href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttprequestclassmappathtopic.asp" target="_blank">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref...ml/frlr</a>

Hope this helps!


--
Regards,
Kristofer Gafvert
<a style='text-decoration: underline;' href="http://www.gafvert.info" target="_blank">www.gafvert.info</a> - My Articles and help
<a style='text-decoration: underline;' href="http://www.ilopia.com" target="_blank">www.ilopia.com</a>


Pankaj wrote:

 > Hi,
 > I'm in the situation where I want to get the absolute path of IIS code
base
 > directory (i.e. typically <website name>\bin ), without passing the
website
 > (virtual directory) name.
 >
 > As the default current directory (or working directory) for the IIS is
 > "C:\WINNT\system32\inetsrv", the "Directory.GetCurrentDirectory()" method
 > always returns "C:\WINNT\system32\inetsrv" and not the path where actual
 > binary files of the website are residing.
 >
 > Can anybody help me by telling how do I get the absolute path of the
 > directory "without passing the website name" ?
 >
 > Thanks in advance
 > Pankaj A. Chitriv<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Getting IIS Code base directory 
Back to top
Login to vote
Pankaj

External


Since: Feb 07, 2005
Posts: 2



(Msg. 4) Posted: Tue Feb 08, 2005 1:09 pm
Post subject: Re: Getting IIS Code base directory [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks Kristofer and Grezegorz.
Well, it is not a asp.net app. Its a .Net remoting application. The simplest
way I got, to get the path is

Page pg = new Page();
string strAbsPath = pg.Server.MapPath(".") + "\\bin\\";

So unlike "HttpRequest" object creation, I don't have to bother abt any
parameters to get the physical path.

Thanks a lot any ways,
Pankaj A. Chitriv


"Kristofer Gafvert" wrote:

 > Hi,
 >
 > I think that what you are looking for is the HttpRequest.MapPath method
 >
 > Here's a link to the MSDN documentation:
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttprequestclassmappathtopic.asp</font" target="_blank">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref...ml/frlr</a>>
 >
 > Hope this helps!
 >
 >
 > --
 > Regards,
 > Kristofer Gafvert
 > <a style='text-decoration: underline;' href="http://www.gafvert.info" target="_blank">www.gafvert.info</a> - My Articles and help
<font color=purple> > <a style='text-decoration: underline;' href="http://www.ilopia.com</font" target="_blank">www.ilopia.com</font</a>>
 >
 >
 > Pankaj wrote:
 >
  > > Hi,
  > > I'm in the situation where I want to get the absolute path of IIS code
 > base
  > > directory (i.e. typically <website name>\bin ), without passing the
 > website
  > > (virtual directory) name.
  > >
  > > As the default current directory (or working directory) for the IIS is
  > > "C:\WINNT\system32\inetsrv", the "Directory.GetCurrentDirectory()" method
  > > always returns "C:\WINNT\system32\inetsrv" and not the path where actual
  > > binary files of the website are residing.
  > >
  > > Can anybody help me by telling how do I get the absolute path of the
  > > directory "without passing the website name" ?
  > >
  > > Thanks in advance
  > > Pankaj A. Chitriv
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Getting IIS Code base directory 
Back to top
Login to vote
Display posts from previous:   
   Web Hosting Problem Solving Community! (Home) -> IIS All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]