Creating diretories on Application_Start

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?
 
G

Guenther Liebowitz

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.
 
L

Leonardo Gangemi

If you think you´re smarter than me, you could give a solution for the
problem, instead of saying bullshit!
 
K

Kevin Spencer

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.
 

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

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top