Article View: borland.public.cppbuilder.internet.web
Article #103TIdHTTP Post error 401 Unauthorized
From: Hipolito Lopez
Date: Thu, 24 Apr 2008 00:38
Date: Thu, 24 Apr 2008 00:38
36 lines
1992 bytes
1992 bytes
I'm trying to do a post to a local url in my network using this
code, but I'm getting 401 error (HTTP/1.1 401 Unauthorized), what can I do? or search for? (the machine where I running this is out the domain)
TMemoryStream *aStream = new TMemoryStream();
TStringStream *StrStream = new TStringStream(NULL);
TStringList *a = new TStringList();
TIdURI *uri = new TIdURI("");
TIdMultiPartFormDataStream *Params = new TIdMultiPartFormDataStream();
Params->AddFormField("tarjeta", codta);
Params->AddFormField("tipo", tipo);
Params->AddFormField("monto", monto);
Params->AddFormField("cargo", cargo);
Params->AddFormField("idcajero", idcajero);
Params->AddFormField("cajero", cajero);
IdHTTP1->Request->Clear();
IdHTTP1->Request->BasicAuthentication = true;
IdHTTP1->Request->Username = txtUser->Text;
IdHTTP1->Request->Password = txtPwd->Text;
IdHTTP1->Post(txtUrl->Text, Params, aStream);
aStream->Seek(0, soFromBeginning);
aStream->SaveToStream(StrStream);
StrStream->Seek(0, soFromBeginning);
ShowMessage(StrStream->DataString);
delete a;
delete aStream;
delete Params;
delete uri;
delete StrStream;
Technical Details
Message-ID:
<480fd69f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: feeec,6cfb45e8330af316,start X-Google-Attributes: gidfeeec,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Hipolito Lopez" <hlopezrd@gmail.com> Sender: "Hipolito Lopez" <hlopezrd@gmail.com> Reply-To: "Hipolito Lopez" <hlopezrd@gmail.com> Subject: TIdHTTP Post error 401 Unauthorized Newsgroups: borland.public.cppbuilder.internet.web X-User-Info: 200.88.73.130 NNTP-Posting-Host: 207.105.83.66 Message-ID: <480fd69f$1@newsgroups.borland.com> Date: 23 Apr 2008 17:38:55 -0700 X-Trace: newsgroups.borland.com 1208997535 207.105.83.66 (23 Apr 2008 17:38:55 -0700) Lines: 36 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail