473,495 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Difference between PolicyException and SecurityException

I have been learning really hard to understand this .NET security thing, but
I still get overwhelmed with the abstractness.
The hardest part is to understand *when* you get an SecurityException and
*how* I would translate this into a simple-user-friendly messagebox.
And *when* you get a PolicyException and I also want to translate this into
a simple-user-friendly messagebox.

The idea is then to start up some HtmlHelp/WinHelp/web-page/readme.txt/...
in order to explain the user/his administrator how to configure this
program.
But as long as I don't understand this completely, then I cannot expect
other users of my program to understand this.

------------------
try {
Form1 form1 = new Form1();
Application.Run(form1);

} catch (System.Security.SecurityException e) {

string sError="This user account have not enough security rights to run
this program!\r\r"+e.ToString();
MessageBox.Show(sError+"\r\rThis program will now terminate!","ctRepair:
Security error",MessageBoxButtons.OK,MessageBoxIcon.Error);

} catch (System.Security.Policy.PolicyException e) {

string sError="The administrator of this machine did not give enough
trust this program to run!\r\r"+e.ToString();
MessageBox.Show(sError+"\r\rThis program will now terminate!","ctRepair:
Security policy error",MessageBoxButtons.OK,MessageBoxIcon.Error);

} catch (System.SystemException e) {

string sError="A system exception has occurred!\r\r"+e.ToString();
MessageBox.Show(sError+"\r\rThis program will now terminate!","ctRepair:
Security error",MessageBoxButtons.OK,MessageBoxIcon.Error);

} catch (System. Exception e) {

string sError="This program caused an unknown exception!:\r\r
"+e.ToString();
MessageBox.Show(sError+"\r\rThis program will now terminate!","ctRepair:
Unknown exception",MessageBoxButtons.OK,MessageBoxIcon.Err or);

} catch {

string sError="This program caused an unknown exception!:\r\r ";
MessageBox.Show(sError+"\r\rThis program will now terminate!","ctRepair:
Unknown exception",MessageBoxButtons.OK,MessageBoxIcon.Err or);
}
Nov 22 '05 #1
0 728

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1420
by: | last post by:
I have been learning really hard to understand this .NET security thing, but I still get overwhelmed with the abstractness. The hardest part is to understand *when* you get an SecurityException and...
0
922
by: MezzCowles | last post by:
Hey all, I've got a .NET program that we've written, and since it writes to and reads from the HD, it, of course, throws a PolicyException when we run it across the network. That's perfectly...
2
1920
by: =?Utf-8?B?QW5kcmVhIEdhbGxhenpp?= | last post by:
Hello, I have a website on a NAS. Permissions are set correctly because I can open HTML files. When framework is involved i receive this exception: System.Security.Policy.PolicyException:...
1
1387
by: bytesFlast | last post by:
Hi all, I would like to know what performance difference can arise if I use separate SQLConnection objects on each Form of a Multi-Form Windows .NET Application and a Single Common/Global SQL...
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6878
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.