Thomas
asked on
THTTPRIO username and password
The code below is executed when a user clicks a button.
It asks the user for a username/password and tries to upload a file to a webservice.
When the username/password combination is correct, everything works fine. But when the user types an incorrect username/password combination, this functions crashes. ( which is normal, because authentication failed...) .
After such a crash, the code no longer works, even after rerunning the same procedure this time with the correct username/password combination.
The only solution I found is to restart the whole application... There has to be a better way?
Does the HTTPRIO object cache my incorrect username/password? Or .... ?
It asks the user for a username/password and tries to upload a file to a webservice.
When the username/password combination is correct, everything works fine. But when the user types an incorrect username/password combination, this functions crashes. ( which is normal, because authentication failed...) .
After such a crash, the code no longer works, even after rerunning the same procedure this time with the correct username/password combination.
The only solution I found is to restart the whole application... There has to be a better way?
Does the HTTPRIO object cache my incorrect username/password? Or .... ?
RIO := THTTPRIO.Create(nil);
RIO.HTTPWebNode.UserName :=Username;
RIO.HTTPWebNode.Password :=PassWord;
webserver := GetCRS( True, '' , RIO );
// get file to upload and encode it in base64
myFileToUpload := TByteDynArray( TEncoding.UTF8.GetBytes( xml.XML.Text ) );
// create upload file request object
myUploadFileRequest := UploadFileRequest.Create;
myUploadFileRequest.UploadFile := PayLoadType( myFileToUpload );
// upload file to server
myUploadFileResponse := webserver.uploadFile_A2A( myUploadFileRequest ); --> Crash
ASKER
Changed the code to the suggestion of Ferruccio Accalai, but still no result.
Added onBeforePost and onBeforeExecute ... Both procedure don't even get called ...
Is there anyone who can give me a clue how to solve this issue?
Added onBeforePost and onBeforeExecute ... Both procedure don't even get called ...
Is there anyone who can give me a clue how to solve this issue?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Found the answer myself.
Something like
Open in new window