Home All Groups Group Topic Archive Search About

Security permissions issue

Author
22 May 2006 10:26 PM
Rich Moore
I've written an app in Visual Studio 2003 (C#) that I want to correctly
handle situations when the app is run from a network share.  I've written
some code in the main form constructor to attempt to access the registry. 
I've put this code inside a try/catch block and my app correctly displays a
nice error message to the user that the app will end.  When this occurs, I
call Application.Exit() to exit out of my app but that causes another
security exception (I guess the Application.Exit requires permissions that
aren't available).

I've read some sites online that say the best solution is just to call the
..Close function for the form rather than Application.Exit.  This isn't
working correctly, maybe because you can't call Close in the constructor?  (A
security exception occurs anyway) Do I need to move all of this code to the
..Load function or is there a better way to handle this?  (Ideally, my app
shouldn't just exit, but I'll cross that bridge when I get this working)

Any help would be appreciated.

Rich Moore

AddThis Social Bookmark Button