How Visual Guard .Net secures a Dotnet application

When a user is authenticated, Visual Guard .Net loads permissions for this user from the repository. These permissions will execute security actions on the application.

In a WinForm application, Visual Guard will intercept the instantiation of System.Windows.Forms.Form classes and will automatically execute security actions on these objects. For more information about Page and MasterPage security, see How Visual Guard secures a Windows Form

In a WebForm application, Visual Guard will intercept the instantiation of System.Web.UI.Page and System.Web.UI.MasterPage classes and will automatically execute security actions on these objects. For more information about Page and MasterPage security, see How Visual Guard secures Page or MasterPage.

For other types of classes (WebService, WebControl, UserControl, non graphic class...), you must implicitly call Visual Guard. In each securable class, you must do the following:

When you call the method SetSecurity, Visual Guard gets all security actions for the specified object. If some security actions must be executed when the security is loaded, Visual Guard executes them. If some actions must be executed on specific events of the object, Visual Guard will bind these events and the action will be executed when the events are raised.

If you do not want to use the automatic interception for a class, see How to disable the automatic interception of a class.

Security action condition

Visual Guard enables you to add a condition to a security action. This condition is based on the value of a boolean property of the target object. Just before executing the security action, Visual Guard evaluates the condition and executes the action only if the condition is equal to true

How Visual Guard secures a Windows Form

When you create a new form in your application, Visual Guard intercepts this instantiation, executes the constructor of the object and loads the security for this object and returns the instantiated object.

If security actions are defined to be executed when the security is loaded (this is a default event for an action), Visual Guard will execute these actions. If actions are defined to be executed on events of the object (or on events of a nested object), Visual Guard will handle these events, and these actions will be executed when the event is raised.

How Visual Guard secures form

How Visual Guard secures a Page or a MasterPage in a WebForm application

When a page is requested, Visual Guard intercepts its instantiation and binds the init event of the object. When the init event is raised, Visual Guard loads the security of the object.

If security actions are defined to be executed when the security is loaded (this is a default event for an action), Visual Guard will execute these actions. If actions are defined to be executed on events of the object (or on events of a nested object), Visual Guard will handle these events, and these actions will be executed when the event is raised.

How Visual Guard secures webfomr 

How to disable the automatic interception of a class

If you do not want to want to set the security of a form automatically, you can implement the interface Novalys.VisualGuard.Security.VGISecurable. Visual Guard will not intercept the instantiation of this form and it will not automatically set the security for the instances of this class and all instances of class derived from this class. To set the security of these objects, you must call implicitly the method VGSecurityManager.SetSecurity.

If you want to disable automatic interception for all classes in your application, you can set the 'VSecurityManager.AllowAutomaticInterception' to false. In a , this property must be changed before loading the security of a user.

See Also
Debugging Visual Guard Security Actions
How to apply security in your application