is there a way to figure out where http://localhost points to? I want to get the local path
Printable View
is there a way to figure out where http://localhost points to? I want to get the local path
I'm interested. Why?
A quick look on my mahchine show a registry key HKLM\Software\Microsoft\InetStp PathWWWRoot as c:\inetpub\wwwroot - which is where my root is. So I suppose you could grab it from there.
Unsure whether there's some object that encapsulates IIS and you can get some property.
Mike
well I wanna open a solution file (for an asp project) and the project paths are relative to localhost. So I'm guessing there is a proper way to figure out the location of the default site folder :rolleyes: so you think that registry value is the right one?
I don't know if that's the correct registry value or not - it was just a quick look. But I'm guessing it's the one.
But again, why? localhost is your machine, why do you need to figure out where the wwwroot is? Whenever I create a default web application, the solution file is not created under Inetpub anway.
I assume you're talking about your local machine, or a machine on your LAN. If not, guess I don't know what I'm talking about :)
Mike
umm btw that registry path gives me C:\Inetpub\wwwroot, which is not my iis default folder (I changed mine to something else)
the reason I need to know it is because if you open up a solution that contains a asp.net project file (open it in notepad), you'll see that the project path is written relative to http://localhost. So for me, to be able to find the path of the project, I have to know where localhost is :D I think thats what I have to do:D:D
I must be dumb, because I still don't understand the why of what you're doing. But anyway, when I open up a .sln file, it has the full path - i.e. http://localhost/WebApplication1/WebApplication1.vbproj - this is VS 2003.
Maybe you can search the registry to see what the key is for the value of your local host.
Mike
ok, now what I'm askign is how can you figure out what folder in your computer this path represents: http://localhost/WebApplication1/WebApplication1.vbprojQuote:
Originally posted by Mike Hildner
I must be dumb, because I still don't understand the why of what you're doing. But anyway, when I open up a .sln file, it has the full path - i.e. http://localhost/WebApplication1/WebApplication1.vbproj - this is VS 2003.
Maybe you can search the registry to see what the key is for the value of your local host.
Mike
if you try to open that file with StreamReader you'll get an error cuz it wont be able to find the path. You have to change the path from http protocol to file protocol or just the way normal paths are displayed.
Ok - I see now, yes, I am dense. But did you search your registry? How about HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\Virtual Root? Name = "/"
yeah that seems to be the right path... but before I go with that, I wanna see if this thing works: Would someone help me to figure out how to use this in a windows applicatoin? I think I used it in an asp.net application a long time ago, but dunno how to use it in a windows app. I've added the system.web reference and now I wanna be able to use this:Quote:
Originally posted by Mike Hildner
Ok - I see now, yes, I am dense. But did you search your registry? How about HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\Virtual Root? Name = "/"
System.Web.HttpContext.Current.Server.MapPath()
If I try to call it, it gives me a null reference error (cuz Current has a value of nothing) :rolleyes: how do I get this to work?:D