Getting Application Path Physical location

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a problem in getting asp.net application physical path in global.ascx
static function

in my global.ascx i have a static function :
first i tried to get the physical path by refelection using

string rootPath =
Path.GetDirectoryName(System.Refelection.Assmebly.GetExecutingAssembly().Location);
but the problem it returned a path in temprary folder in
/winnt/framework/ver/temporay asp.net files ..i do not know why?

then i tried Server.MapPath but exception occured with following message
System.Web.HttpException: Server operation is not available in this context.


what should I do to get aspnet application physical path?
 
Hello Raed,

The temporary folder is not that strange at all. Every aspx and ascx file
will be compiled to source-code. The compiled code will be in the temporary
directory.

I'm not sure what you should do to get the aspnet application physical path.

Regards,

Mark Monster
 
Back
Top