【问题标题】:Iphone AsiHttpRequest authentification RESTServiceIphone 作为 iHttpRequest 身份验证 REST 服务
【发布时间】:2011-05-09 10:09:08
【问题描述】:

我尝试在 REST 上连接我的应用程序。

我不明白,当我第一次尝试连接时,它失败了 (403)。当我重试时,很好! (我目前没有有效的证书)

        request = [ASIHTTPRequest requestWithURL:url];
    [request setUsername:login];
    [request setPassword:password];
    [request setDelegate:delegate];
    [request setRequestMethod:GET];
    [request setValidatesSecureCertificate:NO];
    /*I keep my login/pass*/
    [request setShouldPresentCredentialsBeforeChallenge:YES];
    [request setUseSessionPersistence:YES];
    [request setShouldAttemptPersistentConnection:YES];
    [request setPersistentConnectionTimeoutSeconds:15.0];
    [request setUseCookiePersistence:YES];
    /**/
    [request startSynchronous];  

并记录:

   requestUrl:https://urlToLogin

 login:user

 pwd:pwduser


 Starting synchronous request <ASIHTTPRequest: 0x504fc00>

 Request #1 will use connection #1

 ===Used: 0 bytes of bandwidth in last measurement period===

 Request <ASIHTTPRequest: 0x504fc00> received response headers

 Got a keep-alive header, will keep this connection open for 15.000000 seconds

 Request <ASIHTTPRequest: 0x504fc00> finished downloading data (118 bytes)

 Request #1 finished using connection #1

 codeResponce:403

 requestUrl:https://urlToLogin

 login:user

 pwd:pwduser

 Starting synchronous request <ASIHTTPRequest: 0x603a600>

 Request #2 will use connection #1

 Request <ASIHTTPRequest: 0x603a600> received response headers

 Got a keep-alive header, will keep this connection open for 15.000000 seconds

 ===Used: 138 bytes of bandwidth in last measurement period===

 Request <ASIHTTPRequest: 0x603a600> finished downloading data (20 bytes)

 Request #2 finished using connection #1

 Request finished: <ASIHTTPRequest: 0x603a600>

【问题讨论】:

    标签: iphone authentication asihttprequest


    【解决方案1】:

    看起来可能不是您的应用出错了,而是您尝试连接的服务器 - 403 表示被禁止,因此重试不应修复它。

    你想连接什么?

    【讨论】:

      猜你喜欢
      • 2020-06-24
      • 2014-12-25
      • 2013-06-22
      • 2013-11-12
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 2014-01-10
      • 2013-05-15
      相关资源
      最近更新 更多