Knowledgebase: How to integrate
What is the code needed for VG to read forms?
Posted by Jean-jacques Jouanneaux on 17 August 2010 10:22 PM
Can you send the code to be integrated in the application that will allow VG to read the application forms?
As for ASPX the code will be integrated in the webconfig or in the home page?
If it is a webconfig the code will be integrated in the load form of the application or in another place?
For an ASP .Net application the only thing that you need to do is to change the file web.config by adding the following statement:
<add type="Novalys.VisualGuard.Security.WebForm.VGHttpModule,Novalys.VisualGuard.Security.WebForm" name= "VGModule"/>
The Visual Guard module will then interpret the loading of the forms and will secure them. There is no need to add code.
If the application uses an authentication mode of Form type you must develop a connexion form that will allow the entry of the user and of the password and to use the following code to validate the authentication:
if (VGSecurityManager.Authenticate(usernameTextBox.Text, password).IsFailed)
FormsAuthentication.RedirectFromLoginPage (usernameTextBox.Text, remenberCheckBox.Checked);
If VGSecurityManager.Authenticate(usernameTextBox.Text, password).IsFailed Then
' the authentication has failed, show an error…
' Redirect to the url.
FormsAuthentication.RedirectFromLoginPage(usernameTextBox.Text , remenberCheckBox.Checked);
For the applications Winform, VG automatically finds the creation of forms and secures them without adding code. It is only necessary to call the connection window of Visual Guard (or to use yours) when the application is launched.
To secure classes that are not forms you need to add the interface VGISecurable to the class statement and the following code at the end of the class constructer:
Visual Guard .NET - Version 2.7.806.18