Android Question okHTTP replaced with HTTP issues are coming.

Discussion in 'Android Questions' started by Juzer Hussain, Sep 7, 2015.

  1. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi,
    My app was connecting fine suddenly i started getting msg "HTTP Error 403.0 - ModSecurity Action You do not have permission to access this file or folder" as such i replaced HTTP with okHTTP. But app is still not connecting.Pls help.

    Juzer
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Why do you think that it is related to OkHTTP? You say that the error started before you changed the library.
     
  3. Juzer Hussain

    Juzer Hussain Active Member Licensed User

  4. RandomCoder

    RandomCoder Well-Known Member Licensed User

    You don't mention what it is that you are connecting too? Is it possible that something has changed on that side?
    I've had this problem before on some Windows pc's when trying to access file shares. It turned out to be the file sharing permissions.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    It has nothing to do with OkHttp. ModSecurity is a sophisticated server firewall. It rejects the requests for some reason.

    Try to set the user agent.
     
  6. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi Erel,
    I tried typing "www.website.com/pagename.aspx?Query=!Select * from companymaster! and it reproduced the issue saying "
    HTTP Error 406.0 - ModSecurity Action
    The resource cannot be displayed because the file extension is not being accepted by your browser.

    This indeed look like security issue.
    I will appreciate if you could point me to some example of "using setting user agent"

    Thanks
    Juzer
     
  7. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    continued...

    and below it says
    Most Likely cause
    "The request was rejected because it contained an Accept header for a MIME type that is not supported for the requested file extension."
    Try
    "Verify the MIME settings for the file extension that was requested to make sure this MIME type is acceptable."

    Juzer
     
  8. sorex

    sorex Expert Licensed User

    use this right after your job.download call

    Code:
    dljob.GetRequest.SetHeader("User-Agent""Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0")
    altho I doubt that would solve that issue. Does that page work when copying it in a browser's address bar?
     
  9. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi Sorex,
    No it doesn't work from browser.It says the error HTTP Error 406.0 - ModSecurity Action as i said above.
    I tried using above string after job1.download2 it says
    "(Intent) Intent { cmp=b4a.example/anywheresoftware.b4a.samples.httputils2.httputils2service }"
    "<title>IIS 7.5 Detailed Error - 406.0 - ModSecurity Action</title> "

    I have no clue what to do?

    Juzer
     
  10. sorex

    sorex Expert Licensed User

    what is the full url?

    PM it if you don't want it to appear here.
     
  11. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Sorex, I mailed to support full URL pls check
     
  12. sorex

    sorex Expert Licensed User

    only Erel has access to that then. I'm not in his team.
     
  13. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    where should i mail you?
     
  14. sorex

    sorex Expert Licensed User

    click on my name and then Start Conversation
     
  15. sorex

    sorex Expert Licensed User

    I have the impression that part of the querystring is getting cut off.
     
  16. sorex

    sorex Expert Licensed User

    how do you return the data?

    you should just "print" the data, don't mess around with none standard mime type outputs. that's the problem it seems.
     
  17. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi,
    I have posted the connection module can u pls check it.
    Thanks
    Juzer
     

    Attached Files:

  18. sorex

    sorex Expert Licensed User

    you should check your aspx file on how you return the data.
     
  19. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    It returns a Json string
    Response.Write(j.Serialize(list.ToArray()));
    With the same aspx file i was connected regularly earlier without any problems.
     
  20. sorex

    sorex Expert Licensed User

    well, it doesn't work when I copy the url in my desktop browser either.

    it gives a 403 error, when I modify it a little it passes that but then it gives a 406 error and nags about unknown mimetypes.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice