U
ufolink
Unregistered / Unconfirmed
GUEST, unregistred user!
我这样作的:
delphi7 ->file->new->Web Server Applicition ->CGI Stand-alone executable
在 WebModule1 双击 ->Add new ->WebActionitem1,属性:PathInfo :/test
WebActionitem2 属性:PathInfo : /default Default:true
完整代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp;
type
TWebModule1 = class(TWebModule)
procedure WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
implementation
{$R *.DFM}
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
Page: TStringList;
begin
Page := TStringList.Create;
try
with Page do
begin
Add('<HTML>');
Add('<HEAD>');
Add('<TITLE>Web Server Application -- Basic Sample</TITLE>');
Add('</HEAD>');
Add('<BODY>');
Add('<B>This page was created on the fly by Delphi </B><P>');
Add('<HR>');
Add('See how easy it was to create a page on the fly with Delphi''s Web Extensions?');
Add('</BODY>');
Add('</HTML>');
end;
Response.Content := Page.Text;
finally
Page.Free;
end;
Handled := True;
end;
procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := 'Default Action';
end;
end.
编译生成 :Project1.exe
把Project1.exe copy to
xp C:/Inetpub/wwwoot 下(已经安装IIS) 打开IE 在url 输入:
http://127.0.0.1/Project1.exe/test
没有看到网页,只是闪了一下。为什么?
使用 ISAPI 项 生成.dll 也不行。即:
http://127.0.0.1/Project1.dll/test
错误原因在那里?
delphi7 ->file->new->Web Server Applicition ->CGI Stand-alone executable
在 WebModule1 双击 ->Add new ->WebActionitem1,属性:PathInfo :/test
WebActionitem2 属性:PathInfo : /default Default:true
完整代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp;
type
TWebModule1 = class(TWebModule)
procedure WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
procedure WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
implementation
{$R *.DFM}
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
Page: TStringList;
begin
Page := TStringList.Create;
try
with Page do
begin
Add('<HTML>');
Add('<HEAD>');
Add('<TITLE>Web Server Application -- Basic Sample</TITLE>');
Add('</HEAD>');
Add('<BODY>');
Add('<B>This page was created on the fly by Delphi </B><P>');
Add('<HR>');
Add('See how easy it was to create a page on the fly with Delphi''s Web Extensions?');
Add('</BODY>');
Add('</HTML>');
end;
Response.Content := Page.Text;
finally
Page.Free;
end;
Handled := True;
end;
procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := 'Default Action';
end;
end.
编译生成 :Project1.exe
把Project1.exe copy to
xp C:/Inetpub/wwwoot 下(已经安装IIS) 打开IE 在url 输入:
http://127.0.0.1/Project1.exe/test
没有看到网页,只是闪了一下。为什么?
使用 ISAPI 项 生成.dll 也不行。即:
http://127.0.0.1/Project1.dll/test
错误原因在那里?