|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to get the application path :Si need a hand guys i'm implementing a small program to list all virtual directories to the user and give him some facilities to move or delete these files, fine?? i can easily retrieve the list of all virtual directories using the code below System.DirectoryServices.DirectoryEntry iISAdmin = new System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1/ root"); then where is the problem, thats a good question :) my problem that i've been facing for 3 days now, or even more, is that how can i get the physical or actual path of the virtual path returned from the code snippet above. for example i get from the above piece of code "IIS://localhost/W3SVC/ 1/root/Webapplication1" but i can't send this path as an argument to File.move() or File.delete(), i get a not supported format exception what am i using, thats another good question :) :), i'm using VS2003, c# IIS6 P.S. this program i'm trying to develop is a desktop application and not a web application for security wise. Thank you all and waiting eagerly for ur replies In article <1170680202.777209.21***@j27g2000cwj.googlegroups.com>,
Developer.M***@gmail.com says... Show quote > i'm implementing a small program to list all virtual directories to string path = iISAdmin.Properties["Path"].Value.ToString();> the user and give him some facilities to move or delete these files, > fine?? > > i can easily retrieve the list of all virtual directories using the > code below > System.DirectoryServices.DirectoryEntry iISAdmin = new > System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1/ > root"); > > then where is the problem, thats a good question :) > my problem that i've been facing for 3 days now, or even more, is that > how can i get the physical or actual path of the virtual path returned > from the code snippet above. Thanks patrick for the gr8 help :)
butr when i try it i get System.Reflection.TargetInvocationException any ideas why and how to solve it?? On Feb 6, 4:58 am, Patrick Steele <patr***@mvps.org> wrote: Show quote > In article <1170680202.777209.21***@j27g2000cwj.googlegroups.com>, > Developer.M***@gmail.com says... > > > i'm implementing a small program to list all virtual directories to > > the user and give him some facilities to move or delete these files, > > fine?? > > > i can easily retrieve the list of all virtual directories using the > > code below > > System.DirectoryServices.DirectoryEntry iISAdmin = new > > System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1/ > > root"); > > > then where is the problem, thats a good question :) > > my problem that i've been facing for 3 days now, or even more, is that > > how can i get the physical or actual path of the virtual path returned > > from the code snippet above. > > string path = iISAdmin.Properties["Path"].Value.ToString(); > > -- > Patrick Steelehttp://weblogs.asp.net/psteele thanks patrick for the great help :D
but when i try this it i get System.Reflection.TargetInvocationException any ideas why and how to solve it?? On Feb 6, 4:58 am, Patrick Steele <patr***@mvps.org> wrote: Show quote > In article <1170680202.777209.21***@j27g2000cwj.googlegroups.com>, > Developer.M***@gmail.com says... > > > i'm implementing a small program to list all virtual directories to > > the user and give him some facilities to move or delete these files, > > fine?? > > > i can easily retrieve the list of all virtual directories using the > > code below > > System.DirectoryServices.DirectoryEntry iISAdmin = new > > System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1/ > > root"); > > > then where is the problem, thats a good question :) > > my problem that i've been facing for 3 days now, or even more, is that > > how can i get the physical or actual path of the virtual path returned > > from the code snippet above. > > string path = iISAdmin.Properties["Path"].Value.ToString(); > > -- > Patrick Steelehttp://weblogs.asp.net/psteele In article <1170749017.322006.221***@v33g2000cwv.googlegroups.com>,
Developer.M***@gmail.com says... > thanks patrick for the great help :D Hmmmm... I just started with your code and dug around to find the > but when i try this it i get > System.Reflection.TargetInvocationException > > any ideas why and how to solve it?? Properties collection and what was in it. What's the InnerException of the TargetInvocationException? actually i found that it throws this exception because the local path
is not stored in the properties of the application its self under iis. ratherthan having the full path /theapplicationname is stored, thus the hresult of the request is not defined and hence it throws this exception On Feb 6, 2:31 pm, Patrick Steele <patr***@mvps.org> wrote: Show quote > In article <1170749017.322006.221***@v33g2000cwv.googlegroups.com>, > Developer.M***@gmail.com says... > > > thanks patrick for the great help :D > > but when i try this it i get > > System.Reflection.TargetInvocationException > > > any ideas why and how to solve it?? > > Hmmmm... I just started with your code and dug around to find the > Properties collection and what was in it. What's the InnerException of > the TargetInvocationException? > > -- > Patrick Steelehttp://weblogs.asp.net/pstee |
|||||||||||||||||||||||