Exception handling class

  • Thread starter Thread starter Rotsey
  • Start date Start date
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
 
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
 
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
 
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.
 
good idea Robin.

But wouldn't Vista take care of the app folder and map it to someone else
 
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.
-------------------------
 
Back
Top