Creating diretories on Application_Start

  • Thread starter Thread starter Leonardo Gangemi
  • Start date Start date
L

Leonardo Gangemi

I defined some diretories in the Web.config that can be changed without
recompiling.
This should be directories relative to the application directory.

e.g:

<!-- for log files -->
<add key="RelativeLogDir" value="log\" />

<!--for files generated for other applications -->
<add key="RelativeExportDir" value="export\" />

To do not need to test if theses directories have been created every place
on the application, I decided to test (and create, if necessary) on
Application_Start() of Global.asax.cs.
But I dont know how to get the Application root path inside this method,
since dont have Request to use on
request.ServerVariables["APPL_PHYSICAL_PATH"];

Any suggestions?
 
Any suggestions?

Yes, I have a few. (1) Contract it out. (2) Hire someone who is smarter than
you. (3) Get a job bagging groceries at the local supermarket.
 
If you think you´re smarter than me, you could give a solution for the
problem, instead of saying bullshit!
 
If I understand you correctly, the value you are looking for is:

AppDomain.CurrentDomain.BaseDirectory


--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.
 
Back
Top