Security permissions issue


G

Guest

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
 
Ad

Advertisements


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