晓
晓风月
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button2Click(Sender: TObject);
const
BaseURL = 'http://192.168.2.25/'; //论坛所在地址
UserName = 'sa'; //登录用户名
Password = '123'; //登录密码
var
Params: TStrings;
HTML: String;
MD5Pass: String;
ret:tstringstream;
begin
Params:=TStringList.Create;
ret:=TStringStream.Create('');
try
Params.Clear;
Params.add('txt_user='+UserName);
Params.Add('txt_password='+Password);
IDHttp.HandleRedirects := true;
IdHTTP.request.contenttype:='application/x-www-form-urlencoded';
IdHTTP.Request.Referer := BaseURL + 'test/login.asp';
IdHTTP.Post(BaseURL+'test/login_check.asp',Params,ret);
HTML:=ret.datastring;
Memo1.Lines.Text := HTML;
if Pos(BASEURL+'login.asp',HTML)=0 then
begin
ShowMessage('登录失败');
Exit;
end;
finally
Params.Free;
end;
end;
------------------
asp代码说明:
登录后提交的页面是:login_check.asp
在这个页面中我的测试代码简单的只有以下:
username=trim(Request.Form("txt_user")
response.write "username=" & username
password=trim(Request.Form("txt_password")
response.write "password=" & password
----------------------------
问题:按正常应该是username=sa
password=123
但实际遇到的问题是username=satxt_password=123
password=
不解呀!!!!!!为什么我传的是两个参数,但程序却把两个参数当作了一个参数?
const
BaseURL = 'http://192.168.2.25/'; //论坛所在地址
UserName = 'sa'; //登录用户名
Password = '123'; //登录密码
var
Params: TStrings;
HTML: String;
MD5Pass: String;
ret:tstringstream;
begin
Params:=TStringList.Create;
ret:=TStringStream.Create('');
try
Params.Clear;
Params.add('txt_user='+UserName);
Params.Add('txt_password='+Password);
IDHttp.HandleRedirects := true;
IdHTTP.request.contenttype:='application/x-www-form-urlencoded';
IdHTTP.Request.Referer := BaseURL + 'test/login.asp';
IdHTTP.Post(BaseURL+'test/login_check.asp',Params,ret);
HTML:=ret.datastring;
Memo1.Lines.Text := HTML;
if Pos(BASEURL+'login.asp',HTML)=0 then
begin
ShowMessage('登录失败');
Exit;
end;
finally
Params.Free;
end;
end;
------------------
asp代码说明:
登录后提交的页面是:login_check.asp
在这个页面中我的测试代码简单的只有以下:
username=trim(Request.Form("txt_user")
response.write "username=" & username
password=trim(Request.Form("txt_password")
response.write "password=" & password
----------------------------
问题:按正常应该是username=sa
password=123
但实际遇到的问题是username=satxt_password=123
password=
不解呀!!!!!!为什么我传的是两个参数,但程序却把两个参数当作了一个参数?