Exception handling class

R

Rotsey

Hi,

I have a Nteir project in C#.

I am creating a ExceptionHandling assembly to use throughout the app.

My problem is I want to be able to log exceptions in a XML file
and I want the xml file to be a in the application install folder.

How do I get the startup folder dynamically becasue i am
using a class library and cannot find a class to get that info???

I know i could pass it to the exception handler but that is not
what I want to do.

rotsey
 
K

Kevin Spencer

AppDomain.CurrentDomain.BaseDirectory

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
R

Rotsey

Thanks Kevin your a champ


Kevin Spencer said:
AppDomain.CurrentDomain.BaseDirectory

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
R

RobinS

If you are ever in your life going to deploy your application to Windows
Vista, you will have problems if you put the xml file in the same folder as
the application. Vista won't let the user write to Program Files w/o
administrative access.

If you want to track it for each user, put it in
Environment.SpecialFOlder.LocalApplicationData and it will put it in their
settings.

If you only want one log regardless of user, try CommonApplicationData.

Just a suggestion.

Robin S.
 
R

Rotsey

good idea Robin.

But wouldn't Vista take care of the app folder and map it to someone else
 
R

RobinS

If virtualization is turned on, it would do that, but I wouldn't count on
that being the case. I always program for the worst case scenario. You
*KNOW* you can write to the folder I've specified below, so why not do that
rather than taking a chance on the app working later? Besides, by the time
someone installs it on Vista, you might have forgotten why it won't work...

Robin S.
-------------------------
 

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

Top