Purpose: This document shows the code required inside the Global.asax file to configure the security module for work within a web application.
Required Global.asax Code
All of the code required to configure a StrataFrame web application for use with the StrataFrame Security Module should be placed within the Application_Start() method. This is since the method is only called once, during the first page request after the website’s application pool is restarted.
IsWebEnvironment
The MicroFour.StrataFrame.Security.SecurityBasics class contains the shared (static) property IsWebEnvironment. This property is used to indicate to the security module that the security is being run from within a web application and that the session objects should be used to store the CurrentUser and other session specific data. The IsWebEnvironment property should be set at the top of the Application_Start() method within the Global.asax file.
Imports MicroFour.StrataFrame.Security
...
Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
'-- Set the property
SecurityBasics.IsWebEnvironment = True
End Subusing MicroFour.StrataFrame.Security;
...
protected void Application_Start(object sender, EventArgs e)
{
//-- Set the property
SecurityBasics.IsWebEnvironment = true;
}Other Required Global.asax Code
Other than the IsWebEnvironment variable, the code required to enable specific pieces of the security module within a web application is the same as required within a Windows application. Therefore, any AppMain.vb (program.cs) code that is required for a Windows application should be placed within the Global.asax file of a web application.
A complete description of all code required in AppMain.vb (program.cs) may be found under the Programmatic Access section of this help file.