I had a problem today with some suddenly altered write permissions on my client’s webserver. So I needed to create a new directory that I had total ownership of to work with. That meant trying once again to remember how to use the darned MapPath, etc. It’s one of those things you use once a year or so…
I wrote a little web service utility that I can now shove into any web application (or web service application) on my webserver which returns
From the Application Directory and the BIN folder.
It returns a string that has line returns in it (though if you just run this directly in i.e. you’ll only get one long string).
I packaged these up into a zip file here if anyone wants to use it.
Note – I would not recommend LEAVING them on your webserver after you get the needed info, since they are not at all secure and expose a little more info than you might want to!!
Of course the most fun is giving something a name. I called it What’s My Dir?.
The zip has the tiny source code (an asmx file and a vb file) as well as the compiled dll if you just want to use it, plus a little readme.txt file to be sure you copy the files in the right place (for those unsure)
If you are using .NET 1.1 be sure that this is in your web.config:
<add name=”HttpGet” />
<add name=”HttpPost” />
inside of the
I just whipped this together for myself and it does the trick, so you know … no warranties, guarantees, etc.
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!