×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jun 2008
    Location
    Poland
    Posts
    60

    POST request and authorization/authentication problem

    Hi,

    I've wrote some code based on httpexampleclient from sdk.
    I send http request to IIS server, uri contains link to some file from server. When I use GET request than it works fine I can download this file without problems. If I use POST request and turn on authorization on IIS server than it fails. Message EGotResponseBodyData, GetNextDataPart returns:
    <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\r\n<html dir=ltr>\r\n\r
    \n<h ...
    I've checked, that's beginning of the message that authorization failed.
    No idea what's that, file which I try to download contains just simply text: 'testtext'.
    Code:
    RHTTPHeaders httpHeaders;
    httpHeaders = iHttpTransaction.Request().GetHeaderCollection();
    
    SetHeaderL(httpHeaders, HTTP::EUserAgent, KUserAgent);
    SetHeaderL(httpHeaders, HTTP::EAccept, KAccept);
    SetHeaderL(httpHeaders, HTTP::EUsername, _L8("user"));
    SetHeaderL(httpHeaders, HTTP::EPassword,  _L8("password"));
    (...)
    where SetHeaderL:
    SetHeaderL(RHTTPHeaders aHeaders, TInt aHeaderField, const TDesC8& aHeaderValue)
     RStringF valStr = iHttpSession.StringPool().OpenFStringL(aHeaderValue);
    THTTPHdrVal val(valStr);               aHeaders.SetFieldL(iHttpSession.StringPool().StringF(aHeaderField,RHTTPSession::GetTable()), val);
    valStr.Close();
    Sending post request to this server, when authorization is turned off - works fine.
    GET request - works fine with authorization (GetCredetentials is called).
    When I try to download this file using 'normal' browser (like firefox or opera) I get question about username/password and it works fine. But when I prepared some html form with action='post' than the same problem like in my symbian application.
    It seems that POST request has some problems with calling autorization event (GetCredetentials is not called in symbian, in browser is no window with username/password)
    I'm testing it on emulator S60 FP1.
    Last edited by badzio; 2009-01-19 at 14:25.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,740

    Re: POST request and authorization/authentication problem

    Are you sure about that user-password fields are expected as headers?
    In fact as long as the server-side code does not work with a mere browser, I am not sure why would it work with anything else (including your application).

  3. #3
    Registered User
    Join Date
    Jun 2008
    Location
    Poland
    Posts
    60

    Re: POST request and authorization/authentication problem

    I'm not sure how should I implement authentication. Because I didn't get getcredetentials than I try to pass username/password in header. I'd be enough if after POST callback GetCredetentials was called (like in GET).
    It's a basic authorization on IIS, why it's not supposed to work?

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    4

    Re: POST request and authorization/authentication problem

    Carmelo
    Hi badzio,
    i'm facing a problem accessing some files on a IIS server which requires username and password . When I do an HTTP GET the GetCredentialsL function will never be called. I've followed the WebClient example in the SDK like you. Even if I try to download the files using the internal browser or Opera I'll never see the dialog for username and password input, but I always get an error page with HTTP Error 401.3. Can you help me to resolve this problem ? May be I have have to set some parameters in the Internet access point?

    Thanks a lot

  5. #5
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: POST request and authorization/authentication problem

    Is the IIS server configured to support HTTP basic authentication, or just NTLM (Microsoft Windows NT LAN Manager) authentication?

  6. #6
    Registered User
    Join Date
    Jun 2003
    Posts
    4

    Re: POST request and authorization/authentication problem

    Hi petrib,
    unfortunately I don't know which type of authentication uses the server. In the case it support NTLM is there a way to access throw symbian API?

    Thanks,
    Carmelo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×