Knowledgebase: How to integrate
What is the code needed for VG to read forms?
Posted by z 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:

Code:


< configuration>
<system.web >
...
<httpModules >
<add type="Novalys.VisualGuard.Security.WebForm.VGHttpModule,Novalys.VisualGuard.Security.WebForm" name= "VGModule"/>
</httpModules >
...
</system.web >
</configuration>




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:

Code:


C#
if (VGSecurityManager.Authenticate(usernameTextBox.Text, password).IsFailed)
{

}
else
{
FormsAuthentication.RedirectFromLoginPage (usernameTextBox.Text, remenberCheckBox.Checked);
}
VB.Net
If VGSecurityManager.Authenticate(usernameTextBox.Text, password).IsFailed Then
' the authentication has failed, show an error…
Else
' Redirect to the url.
FormsAuthentication.RedirectFromLoginPage(usernameTextBox.Text , remenberCheckBox.Checked);
End If




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:

Code:


C#
VGSecurityManager.SetSecurity(this)
VB.Net
VGSecurityManager.SetSecurity(this)



Visual Guard .NET - Version 2.7.806.18
(0 vote(s))
Helpful
Not helpful

Comments (0)
Help Desk by Novalys