S snowdot23 Unregistered / Unconfirmed GUEST, unregistred user! 2003-06-19 #1 1 如何知道输入给idhttp的用户名称 密码是错误的 2 如何知道检查给idhttp的url是错误的
C csz Unregistered / Unconfirmed GUEST, unregistred user! 2003-06-19 #4 procedure TForm1.Button2Click(Sender: TObject); begin IdHTTP1.Request.Username := 'testuser'; IdHTTP1.Request.Password := 'test'; try IdHTTP1.Get('http://adfadf'); except case IdHTTP1.ResponseCode of 401 : ShowMessage('错误的用户名密码!'); -1 : ShowMessage('该url地址不存在'); end; ShowMessage(IntToStr(IdHTTP1.ResponseCode)); end; end;
procedure TForm1.Button2Click(Sender: TObject); begin IdHTTP1.Request.Username := 'testuser'; IdHTTP1.Request.Password := 'test'; try IdHTTP1.Get('http://adfadf'); except case IdHTTP1.ResponseCode of 401 : ShowMessage('错误的用户名密码!'); -1 : ShowMessage('该url地址不存在'); end; ShowMessage(IntToStr(IdHTTP1.ResponseCode)); end; end;