unit ServerController;
interface
uses
  SysUtils, Classes, IWServerControllerBase, IWBaseForm, HTTPApp,
  // For OnNewSession Event
  IWApplication, IWAppForm, IWDataModulePool;

type
  TIWServerController = class(TIWServerControllerBase)
    procedure IWServerControllerBaseBeforeDispatch(Sender: TObject;
      Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
  private
  public
  end;

implementation
uses
  CodeSiteLogging;

{$R *.dfm}

procedure TIWServerController.IWServerControllerBaseBeforeDispatch(
  Sender: TObject; Request: TWebRequest; Response: TWebResponse;
  var Handled: Boolean);
begin
  CodeSite.Send(Request.UserAgent);
  if (Pos('iPhone',Request.UserAgent) = 0) and
     (Pos('iPod',Request.UserAgent) = 0) and
     (Pos('iPad',Request.UserAgent) = 0) and
     (Pos('Andriod',Request.UserAgent) = 0) then
  begin
    Response.SendRedirect('http://www.bobswart.nl/blog');
    Handled := True;
  end;
end;

initialization
  TIWServerController.SetServerControllerClass;
end.

