B Bratt Member Licensed User Longtime User Apr 8, 2014 #1 Dim jobLogin As HttpJob jobLogin.Download(loginUrl) I am a beginner in creating apps i am trying to create an app that parses a simple webpage The login works fine but if i change user it logs in with the old user. It seems like jobLogin stores cookies. Can this be the case and if so how can i clear them
Dim jobLogin As HttpJob jobLogin.Download(loginUrl) I am a beginner in creating apps i am trying to create an app that parses a simple webpage The login works fine but if i change user it logs in with the old user. It seems like jobLogin stores cookies. Can this be the case and if so how can i clear them
Erel B4X founder Staff member Licensed User Longtime User Apr 8, 2014 #2 See this thread: http://www.b4x.com/android/forum/threads/httputills2-clear-cookies.20053/#post-116289 Upvote 0
See this thread: http://www.b4x.com/android/forum/threads/httputills2-clear-cookies.20053/#post-116289
B Bratt Member Licensed User Longtime User Apr 8, 2014 #3 Please oversee with my inexperience I have probably misunderstood something. I actually did read that before posting but that post is referring to a HTTPRequest and not HTTPJob. I thought that HTTPRequest was the old way and HTTPJob was the new way. http://www.b4x.com/android/forum/threads/httputils2-web-services-are-now-even-simpler.18992/#content Should i switch all my HTTPJob to HTTPRequest? Or should i add this code to HttpUtils2Service. How can i access the code for HttpUtils2Service? Code: Copy Sub ClearCookies Dim r As Reflector r.Target = hc r.Target = r.GetField("client") r.Target = r.RunMethod("getCookieStore") r.RunMethod("clear") End Sub Upvote 0
Please oversee with my inexperience I have probably misunderstood something. I actually did read that before posting but that post is referring to a HTTPRequest and not HTTPJob. I thought that HTTPRequest was the old way and HTTPJob was the new way. http://www.b4x.com/android/forum/threads/httputils2-web-services-are-now-even-simpler.18992/#content Should i switch all my HTTPJob to HTTPRequest? Or should i add this code to HttpUtils2Service. How can i access the code for HttpUtils2Service? Code: Copy Sub ClearCookies Dim r As Reflector r.Target = hc r.Target = r.GetField("client") r.Target = r.RunMethod("getCookieStore") r.RunMethod("clear") End Sub
B Bratt Member Licensed User Longtime User Apr 8, 2014 #4 Found the files i removed the library and added the files directly to my project instead Added this to HttpUtils2service Code: Copy Public Sub ClearCookies(job As HttpJob) As Int Dim r As Reflector r.Target = hc r.Target = r.GetField("client") r.Target = r.RunMethod("getCookieStore") r.RunMethod("clear") Return 0 End Sub and this to HttpJob Code: Copy 'Clear cookies Public Sub ClearCookies CallSubDelayed2(HttpUtils2Service, "ClearCookies", Me) End Sub Now my login seems to work :=) But i don't know if i added it correctly. Should i use CallSubDelayed2 to call "ClearCookies" or is there a better way Upvote 0
Found the files i removed the library and added the files directly to my project instead Added this to HttpUtils2service Code: Copy Public Sub ClearCookies(job As HttpJob) As Int Dim r As Reflector r.Target = hc r.Target = r.GetField("client") r.Target = r.RunMethod("getCookieStore") r.RunMethod("clear") Return 0 End Sub and this to HttpJob Code: Copy 'Clear cookies Public Sub ClearCookies CallSubDelayed2(HttpUtils2Service, "ClearCookies", Me) End Sub Now my login seems to work :=) But i don't know if i added it correctly. Should i use CallSubDelayed2 to call "ClearCookies" or is there a better way
Erel B4X founder Staff member Licensed User Longtime User Apr 9, 2014 #5 CallSubDelayed is a good way. Note that the job parameter is not required. Upvote 0