in

Foo Theory

Partners in Community - serving up some ice cold Kool-Aid!
Welcome to footheory.com.  The bloggers and contributing members on this site are consultants, project/program managers and software architects working across the US.  Our community will focus on Microsoft technologies, .NET architecture, software patterns & practices and just plain stream of consciousness.

this.Reflect(); - Donn's Weblog

The technology Blog of Donn Felker

TIP: Getting the Base Directory of where your App is running

This is an oldie but a goodie. It was brought up that not one developer at my current client knew about this object in the framework.

So, how do you find where the app is running at?

Easy: Use the AppDomain object. This works for both Web and Non-Web projects.

Code:

1 AppDomain.CurrentDomain.BaseDirectory

The AppDomain object will return the application's domain information, which includes the info about where it is executing. We get the current domain of the executing thread and then get its BaseDirectory to see where it's executing.

This:

image

Returns this:

image

 

Enjoy.

Published Mar 11 2008, 04:18 PM by donnfelker
Filed under:

Comments

No Comments

Leave a Comment

(required)  
(optional)
(required)  
Add
Copyright ASIQS Corporation © 2006, All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems