How to get current folder path?

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
 
C

Chris Jackson

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.)
 
Joined
Jan 20, 2008
Messages
1
Reaction score
0
what about having a property in that class to return its current folder?
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,103
Latest member
VinaykumarnNevatia
Top