How to get current folder path?

  • Thread starter Thread starter Chung
  • Start date Start date
C

Chung

Hi,

I am developing an asp.net application. I have create
some class method and I would like to get the folder path
of that class method. I cannot use this.Mappath("") to get
the path because it is not a type of *.aspx.cs. I try to
use System.Environment.CurrentDirectory() but it return
c:\winnt\system32 when I use
System.Web.HttpContext.Current.Server.MapPath("") it
returns path from the aspx file that call the class method.

I hope someone can help me on my problem.

Chung
 
System.Assembly.Location will give you the file system path to the assembly.
The assembly itself sits in the bin directory of the application root, which
you can also get. The cs file exists only in development. (Well, you could
copy it to production, but that's not a good idea.)
 
Back
Top