protected override void OnSecurityException(SecurityExceptionEventArgs e) { LogError(e.SecurityException); var form = new SecurityExceptionForm(e); form.ShowDialog(); }
public static bool AttachApp() { try { AttachExceptionHandler(new UnhandledExceptionHandlerWithAdvancedUI()); return(true); } catch (SecurityException) { try { Application.EnableVisualStyles(); var securityMessage = string.Format( "{0} cannot initialize itself because some permissions are not granted.\n\nYou probably try to launch {0} in a partial-trust situation. It's usually the case when the application is hosted on a network share.\n\nYou need to run {0} in full-trust, or at least grant it the UnmanagedCode security permission.\n\nTo grant this application the required permission, contact your system administrator, or use the Microsoft .NET Framework Configuration tool.", ApplicationName); var form = new SecurityExceptionForm(new SecurityExceptionEventArgs(securityMessage, false)); form.ShowInTaskbar = true; form.ShowDialog(); } catch (Exception exception) { BasicExceptionDialog(exception); } return(false); } }
public static bool AttachApp() { try { AttachExceptionHandler(new UnhandledExceptionHandlerWithAdvancedUI()); return true; } catch (SecurityException) { try { Application.EnableVisualStyles(); var securityMessage = string.Format( "{0} cannot initialize itself because some permissions are not granted.\n\nYou probably try to launch {0} in a partial-trust situation. It's usually the case when the application is hosted on a network share.\n\nYou need to run {0} in full-trust, or at least grant it the UnmanagedCode security permission.\n\nTo grant this application the required permission, contact your system administrator, or use the Microsoft .NET Framework Configuration tool.", ApplicationName); var form = new SecurityExceptionForm(new SecurityExceptionEventArgs(securityMessage, false)); form.ShowInTaskbar = true; form.ShowDialog(); } catch (Exception exception) { BasicExceptionDialog(exception); } return false; } }