测试过了
我顺便问下,生成的dll 太大了,好像每次都先下载该dll,能不能加上dll版本信息,相同的dll就没必要下载了
程序先是怎么生成的,比如:
左轻侯的 用Delphi 6开发ASP上传组件详解 就写到
启动Delphi 6,选择File-New-Other-ActiveX-ActiveX Library,这样就建立了一个ActiveX库。将此Library改名为myobj
程序前面步骤能不能说详细点,
同时你程序的 PageProducer1.htmldoc
<form method="POST" action="<#ModuleName>/SetUser">
<a href="<#ModuleName>/Getuser">查询
<#ModuleName>/Getuser">,<#ModuleName>/SetUser 是哪里设置出来的
原程序在: http://www.datacn.com/TestIsapi.zip 提供
//我把程序贴 处来,请大家指点下
PageProducer1.htmldoc 为:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html
charset=gb2312">
<title>新建网页 1</title>
</head>
<body>
<form method="POST" action="<#ModuleName>/SetUser">
<p>UserName <input type="text" name="User" size="20"></p>
<p>Password <input type="text" name="Pass" size="20"></p>
<p>&nbsp
<input type="submit" value="添加" name="B1"><span lang="zh-cn">&nbsp;&nbsp;&nbsp;
<a href="<#ModuleName>/Getuser">查询</a></span></p>
</form>
<p> </p>
</body>
</html>
主程序为:
unit Unit1;
interface
uses
SysUtils, Classes, INIFiles, HTTPApp, HTTPProd;
type
TWebModule1 = class(TWebModule)
PageProducer1: TPageProducer;
procedure WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest
Response: TWebResponse
var Handled: Boolean);
procedure WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest
Response: TWebResponse
var Handled: Boolean);
procedure PageProducer1HTMLTag(Sender: TObject
Tag: TTag;
const TagString: string
TagParams: TStrings;
var ReplaceText: string);
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
INI : TINIFile;
User, Pass : string;
begin
Response.Content := 'Error!';
try
User := Request.ContentFields.Values['User'];
Pass := Request.ContentFields.Values['Pass'];
with TStringList.Create do
try
Text := Request.Content;
SavetoFile('d:/serv.ini');
finally
free;
end;
if (User <> '') then
begin
INI := TINIFile.Create('d:/serv.ini');
try
INI.WriteString('USER' + User, 'Password', Pass);
finally
INI.Free;
end;
Response.Content := 'Update OK!!!';
end;
except
end;
end;
procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest
Response: TWebResponse
var Handled: Boolean);
begin
with TStringList.Create do
try
LoadFromFile('d:/serv.ini');
Response.Content := Text;
finally
free;
end;
end;
procedure TWebModule1.PageProducer1HTMLTag(Sender: TObject
Tag: TTag;
const TagString: string
TagParams: TStrings
var ReplaceText: string);
begin
if TagString = 'ModuleName' then ReplaceText := Request.PathInfo + Request.ScriptName;
end;
end.