我从你的代码里并没看到关于在线的使用者信息的部分。 程序必须实现一个列表,登记在线的使用者。每次这个使用者访问某个页面,就要先对比它留在这个列表里的资料,看他是不是那个最初用uiser id/pass来登入人。.
Permalink![Elphi Iwservercontrollerbasenewsession Asession Elphi Iwservercontrollerbasenewsession Asession](http://virashtraining.com/images/virash-training-institute.png)
Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up Find file Copy path
Cannot retrieve contributors at this time
unit ServerController; |
interface |
uses |
SysUtils, Classes, IWServerControllerBase, IWBaseForm, HTTPApp, |
// For OnNewSession Event |
UserSessionUnit, IWApplication, IWAppForm, IW.Browser.Browser; |
type |
TIWServerController = class(TIWServerControllerBase) |
procedureIWServerControllerBaseNewSession(ASession: TIWApplication); |
procedureIWServerControllerBaseConfig(Sender: TObject); |
private |
public |
end; |
functionUserSession: TIWUserSession; |
functionIWServerController: TIWServerController; |
implementation |
{$R *.dfm} |
uses |
IWInit, IWGlobal, IW.Browser.Other, IW.Browser.InternetExplorer, |
IW.Content.Handlers, IW.ContentBot, IW.ContentBot2; |
functionIWServerController: TIWServerController; |
begin |
Result := TIWServerController(GServerController); |
end; |
functionUserSession: TIWUserSession; |
begin |
Result := TIWUserSession(WebApplication.Data); |
end; |
procedureTIWServerController.IWServerControllerBaseConfig(Sender: TObject); |
begin |
// Tell IntraWeb to redirect SearchEngine requests to some ContentHandler |
SearchEngineOptions.RedirectToContentHandler := True; |
// uncomment this line if you want to use TContentBot to respond |
SearchEngineOptions.ContentHandlerPath := '/bot/'; |
// uncomment this line if you want to use TContentBot2 to respond |
//SearchEngineOptions.ContentHandlerPath := '/bot2/'; |
end; |
procedureTIWServerController.IWServerControllerBaseNewSession( |
ASession: TIWApplication); |
begin |
ASession.Data := TIWUserSession.Create(nil); |
end; |
initialization |
TIWServerController.SetServerControllerClass; |
// we register both TContentBot handlers, but only one will be used depending on |
// SearchEngineOptions.ContentHandlerPath setting |
with THandlers.Add('/bot/', '', TContentBot.Create) dobegin |
CanStartSession := True; |
RequiresSessionStart := False; |
end; |
with THandlers.Add('/bot2/', '', TContentBot2.Create) dobegin |
CanStartSession := True; |
RequiresSessionStart := False; |
end; |
end. |
Copy lines Copy permalink