Password by HttpUtils

tudorf

Active Member
Licensed User
Longtime User
I make a download from a webside with HttpUtils.

url1 = "http://www.geocaching.com/seek/cache_details.aspx?wp=GC3TNVF"
If HttpUtils.IsSuccess(url1) Then
s = HttpUtils.GetString(url1)

The result ist not correct. I must have access with my password.

I have modyfy HttpUtilsService.ProcessNextTask and change hc.Execute to hc.ExecuteCredentials.

If hc.ExecuteCredentials (req, task, "my_name","Password") = True Then

The result of ExecuteCredentials gives true but I have not the right Info.

When I load the webside in a Webview then ist the result correct.

Can I have a acces to the string from the webview ?

Martin
 

Attachments

  • wrong_password.JPG
    wrong_password.JPG
    35.5 KB · Views: 177
  • correct.JPG
    correct.JPG
    83.7 KB · Views: 170

mc73

Well-Known Member
Licensed User
Longtime User
Searched a bit some code I wrote some time ago. Why do you use this if condition? I think that you can simply write
B4X:
hc.ExecuteCredentials (req, task, "my_name","Password")
If the operation fails, the hc_responseError sub will be executed, I think.
 
Upvote 0

tudorf

Active Member
Licensed User
Longtime User
The Sub hc_ResponseError is a part from the HttpUtilsService-Modul.

Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
countWorking = countWorking - 1
finishTasks = finishTasks + 1
HandleError(TaskId, Reason)
If Response <> Null Then ' OK or Error
Log(Response.GetString("UTF8"))
Response.Release
End If
ProcessNextTask
End Sub

Which value must habe response ?
Martin
 
Upvote 0
Top