Server Controller

The ServerController is a singleton class. Only one instance of a ServerController will exist in any IntraWeb application.

The ServerController is used to provide configuration information about your application, as well as provide a place for central configuration events.

In code the singleton instance is available by adding ServerController to the uses clause, and then referring to the global IWServerController function.

Properties

AllowMultipleSessionsPerUser: Boolean

Indicates if your application supports multiple user sessions within the same browser window.

AppName: String

Contains the application name.Used when you install your SA Server application as a Service.

AuthBeforeNewSession: Boolean

Informs IntraWeb if the User Authorization will be requested before a user session is created. If you do not uses any custom authorization that depends on any property/method you have declared on your User Session class, leave this property as False.

Auther: TIWAutherBase

Use this property to assign one of the built-in Authorization components from IntraWeb. The Authorization components uses the default browser login/password dialog.

BoundIP: String

Use this property to specify a IP the SA Server application will be bound to. Specially useful when you run your SA Server in a computer with several network adapters.

CacheDir: TIWDirectoryName

Contains the full path to the folder used as the IntraWeb general cache.

ComInitialization: TComInitialization

Informs IntraWeb to call automatically COM initialization routines and the COM model to apply.

Compression: TIWCompressionOptions

Use this property to inform IntraWeb to use compression and also which compression level. IntraWeb compression uses IW zlib (based on zlib Cloudflare).

  • AllowDeflate: Boolean
  • AllowGZip: Boolean
  • Enabled: Boolean
  • Level: Integer
  • MinSize: Integer
  • PreCompress: Boolean

CookieOptions: TIWSessionCookieOptions

  • CookieNameSuffix: String
  • HttpOnly: Boolean
  • SameSite: (ssoLax, ssoNone, ssoStrict)
  • Secure: Boolean
  • SessionCookies: Boolean
  • UseCookies: Boolean

ContentFiles: TStringList

Use this property to add custom JavaScript files to your IntraWeb forms. When you add some content to this property, all IntraWeb forms will include it when rendered. Ensure the files you are adding are available under your ContentPath folder.

CustomLockerAnimationFile: String

Informs IntraWeb the name of your Custom GIF file. The custom GIF file need stay in wwwroot folder.

DebugHTML: Boolean

Description: String

Contains the application Description. Used when you install your SA Server application as a Service.

DisplayName: String

Contains the Display name for the application. Used when you install your SA Server application as a Service.

DocType: String

Use this property to indicate IntraWeb a DocType to be used when rendering your pages.

EnableImageToolbar: Boolean

ExceptionDisplayMode: TIWShowMessageType

(smAlert, smNewWindow, smSameWindow, smSameWindowFrame);

Use this property to inform IntraWeb how to show an Application Exception to the user.

ExceptionLogger: TIWExceptionLogger

Use this property to control the behavior of the TIWExceptionLogger class instance.

  • Enabled: Boolean
  • FileName: String
  • FilePath: String
  • LogType: (ltEventLog, ltFile)
  • PurgeAfterDays: Integer
  • ReportInfos: (riAppInfo, riExceptionInfo, riIWAppInfo, riStackTrace, riRequestInfo)

HTMLHeaders: TStringList

Use this property to add custom tags to the headers of your IntraWeb forms. When you add some content to this property, all IntraWeb forms will include it when rendered.

HTMLLanguage: String

HTML Language Code Reference.

HttpKeepAlive: Boolean

HttpSysOptions: TIWHttpSysOptions

Use this property to control the Windows Kernel mode driver. Http.sys IntraWeb applications are also stand alone.

  • AddDefaultBind: Boolean
  • HostWildCard: (hwStrong, hwWeak)
  • VirtualHostName: String

IECompatibilityMode: String

JavaScriptOptions: TIWJavaScriptOptions

Use this property to control the Embedded JQuery.

  • AjaxErroMode: (emAlert, emConsole, emNone)
  • Debug: Boolean
  • EnableFirebug: Boolean
  • jQueryVersion: String
  • RenderjQuery: Boolean
  • UseUncompressedFiles: Boolean

LockSessionTimeout: Integer

Log: TLogOptions

(loNone, loFile);

Use this property to inform how IntraWeb saves its Log information (used internally by IntraWeb in some parts of the code). When you enable this property, IntraWeb generates the log file in the same folder as your application.

LogCommandEnabled: Boolean

LogSessionEvents: Boolean

MasterTemplate: String

Use this property to specify a name of your master template file for your application. The master template file need stay in template folder.

MobileOptions: TIWMobileOptions

  • ViewportTag: String

PageTransitions: Boolean

Port: Integer = 0

For standalone and http.sys projects, Port specifies the TCP port to listen on. A value of zero specifies that a random free port should be used and can be useful during initial development and debugging.

PostRedirectGet: (prgDisabled, prgEnabled)

ProxyPortRedirection: TIWProxyPortRedirection

Use this property to Redirect to an HTTPS port. ISAPI inclusive. Requires: ServerController.SSLOptions.NonSSLRequest = nsRedirect;

RestartExpiredSession: Boolean

When TRUE, IntraWeb will restart an expired session when it detects that the browser is requesting an expired or invalid session. In fact, the session is not exactly restarted, but a new session is created (with a different Session ID). When possible, the original start parameters will be used in this new version, meaning that the new session will start just like the old expired session.

SearchEngineOptions: TIWSearchEngineOptions

  • ContentHandler: String
  • RedirectToContentHandler: Boolean

SecurityOptions: TIWSecurityOptions

  • CheckFormId: Boolean – When TRUE, IntraWeb will generate a unique FormId hidden field for each IWForm instance. This ID is then checked when the form processes a request.
  • CheckSameIP: Boolean – Will raise an EIWSecurityException if a different IP is used in a subsequent request using the same Session ID. Default True.
  • CheckSameUA: Boolean – Will raise an EIWSecurityException if a different user agent string is used in a subsequent request using the same Session ID. Default True.
  • PreventDoubleSubmission: Boolean –
  • RandomTempFileNames: Boolean –
  • ShowSecurityErrorDetails: Boolean – If false, will omit the error message when one of the above checks fails. Default True.

ServerResizeTimeout: Integer

SessionTimeout: Integer

Use this property to indicate the amount of time (in minutes) a user session can remain idle (ie, no user activity in the browser) at the server side. Read only for Personal and Standard editions with the default value of 20 minutes.

ShowLoadingAnimation: Boolean

ShowStartParams: Boolean

SSLOptions: TIWSSLOptions

SSLOptions contains sub properties described here.

Events

OnAfterDispatch: TOnDispatch

Use this event to make any pos-processment after the your application dispatches a client request. You need to include the units IW.Http.Request (THttpRequest) and IW.Http.Reply (THttpReply) in your uses clause.

  1. procedure TIWServerController.IWServerControllerBaseAfterDispatch(Request: THttpRequest; aReply: THttpReply);
  2. begin
  3.   if (aReply.Code ry<> 404) then begin
  4.     Log(‘User agent: ‘ + Request.UserAgent);
  5.     Log(‘Content Type: ‘ + aReply.ContentType);
  6.   end;
  7. end;

OnBeforeDispatch: TOnDispatch

Use this event to modify the IntraWeb reply before it is sent to the client or any other processment needed by your application. You need to include the units IW.Http.Request (THttpRequest) and IW.Http.Reply (THttpReply) in your uses clause.

  1. procedure TIWServerController.IWServerControllerBaseBeforeDispatch(Request: THttpRequest; aReply: THttpReply);
  2. begin
  3.   if Pos(‘192.168’, Request.RemoteAddr) = 0 then begin
  4.     aReply.SendRedirect(‘http://www.atozed.com’);
  5.   end;
  6. end;

OnCloseSession: TOnCloseSessionEvent

This event is triggered when a User Session is destroyed.

OnException: TOnExceptionEvent

This event is truggered when an Exception occurs in your application.

OnGetSessionID: TOnGetSessionID

This event is triggered after a user session is created and just before IntraWeb creates a session ID for the user session. Use this method if you need to create a custom session ID for each user session.

OnNewSession: TOnNewSessionEvent

This event is triggered just after a new user session is created.

OnBackButton: TOnBackButtonEvent

This event is triggered when the track ID of the application is out of sync.

OnBeforeRender: TOnBeforeRenderEvent

This events triggered before IntraWeb renders the next form to be shown to the user. You can use this event to show another form to the user, instead of the form to be shown.

  1. procedure TIWServerController.IWServerControllerBaseBeforeRender(
  2.   ASession: TIWApplication; AForm: TIWBaseForm; var VNewForm: TIWBaseForm);
  3. begin
  4.   if not UserSession.CheckFormSecurity(AForm.ClassName) then begin
  5.     VNewForm := TLoginForm.Create(WebApplication);
  6.     TLoginForm(VNewForm).FormToRequestAuth := AForm.ClassName;
  7.     AForm.Release;
  8.     AForm := Nil;
  9.   end;
  10. end;

OnAfterRender: TOnAfterRenderEvent

This event is triggered after a form is rendered.

OnUserTag: TOnUserTag

This event is triggered when the IWP parser finds a user tag in a HTML page served by your application. For more information see User Tags.

OnSessionTag: TOnSessionTag

This event is triggered when the IWP parser finds a session tag in a HTML page served by your application.

OnBrowserCheck: TOnBrowserCheckEvent

This event is triggered when a new user is connecting ro your application. Use this event to determine the application behavior in accordance to the browser the user is using.