描述:
用delphi的IdHttp写一个功能,访问http://localhost/test.aspx(带参数)后,得到返回值;
如:IdHttp.Post('http://localhost/test.aspx',S),Memo1能得到id=test pwd=123456
如果直接IdHttp.Post(http://localhost/test.aspx?id=test&pwd=123456)能返回得到id=test pwd=123456以下是我的程序:
procedure TForm1.Button1Click(Sender: TObject);
var
S: TStringList;
begin
S := TStringList.Create;
try
S.Clear;
S.Add('id=test');
S.Add('pwd=123456');
IdHTTP1.HTTPOptions := [];
IDHttp1.HandleRedirects := True;
IDHttp1.request.contenttype:='application/x-www-form-urlencoded';
Memo1.Text:= IDHttp1.Post('http://localhost/test.aspx',S);
finally
S.Free;
end;
end;
test.aspx程序(ASP.NET)
protected void Page_Load(object sender, EventArgs e)
{
string id = Request.QueryString["id"];
string pwd = Request.QueryString["pwd"];
Response.Write("id=" + id + "\r\n");
Response.Write("pwd=" + pwd + "\r\n");
}
目前Memo1返回得到id= pwd=
没有获取到参数值,请问我的程序错在哪里?非常感谢!
用delphi的IdHttp写一个功能,访问http://localhost/test.aspx(带参数)后,得到返回值;
如:IdHttp.Post('http://localhost/test.aspx',S),Memo1能得到id=test pwd=123456
如果直接IdHttp.Post(http://localhost/test.aspx?id=test&pwd=123456)能返回得到id=test pwd=123456以下是我的程序:
procedure TForm1.Button1Click(Sender: TObject);
var
S: TStringList;
begin
S := TStringList.Create;
try
S.Clear;
S.Add('id=test');
S.Add('pwd=123456');
IdHTTP1.HTTPOptions := [];
IDHttp1.HandleRedirects := True;
IDHttp1.request.contenttype:='application/x-www-form-urlencoded';
Memo1.Text:= IDHttp1.Post('http://localhost/test.aspx',S);
finally
S.Free;
end;
end;
test.aspx程序(ASP.NET)
protected void Page_Load(object sender, EventArgs e)
{
string id = Request.QueryString["id"];
string pwd = Request.QueryString["pwd"];
Response.Write("id=" + id + "\r\n");
Response.Write("pwd=" + pwd + "\r\n");
}
目前Memo1返回得到id= pwd=
没有获取到参数值,请问我的程序错在哪里?非常感谢!
asp.net程序错了
protected void Page_Load(object sender, EventArgs e)
{
string id = Request["id"];
string pwd = Request["pwd"];
Response.Write("id=" + id + "\r\n");
Response.Write("pwd=" + pwd + "\r\n");
}来着给分,准备结贴。
string id = Request["id"];
string pwd = Request["pwd"];