title: AFNetworking Expected status code in (200-299), got 403
body: <p>Trying to migrate my code from <code>ASIHttpRequest</code> to <code>AFNetworking</code>. It seems similar questions has been asked but <code>couldnt</code> find solution to my problem. </p>
  
  <p>My code was working fine with <code>ASIHttpRquest</code>.</p>
  
  <p>I send a simple post request to my server and listen http responses. If <code>http response</code> is 200 everything works fine but if I send another status code >400 <code>AFNetworking</code> block fails.</p>
  
  <p>Server side response:</p>
  
  <pre><code>$rc = $stmt-&gt;fetch();
      if ( !$rc ) {
      //  echo "no such record\n";
        $isrecordExist=0; //false does not exists
        sendResponse(403, 'Login Failed');
        return false;
      }
      else {
       // echo 'result: ', $result, "\n";
         $sendarray = array(
              "user_id" =&gt; $result,
          );
          sendResponse(200, json_encode($sendarray));
      }
  </code></pre>
  
  <p>IOS Part:</p>
  
  <pre><code>AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:
                              [NSURL URLWithString:server]];
      client.allowsInvalidSSLCertificate=YES;
  
      [client postPath:loginForSavingCredientials parameters:params success:^(AFHTTPRequestOperation *operation, id response) {
      if (operation.response.statusCode == 500) {}
       else if (operation.response.statusCode == 403) {}
       else if (operation.response.statusCode == 200) {//able to get results here            NSError* error;
          NSString *responseString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
          NSDictionary* json =     [NSJSONSerialization JSONObjectWithData: [responseString dataUsingEncoding:NSUTF8StringEncoding]
                                                                   options: NSJSONReadingMutableContainers
                                                                     error: &amp;error];}
   } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          NSLog(@"failure %@", [error localizedDescription]);
      }];
  </code></pre>
  
  <p>NSLOG:</p>
  
  <pre><code> failure Expected status code in (200-299), got 403
  </code></pre>
  
  <p>How can I fix this? </p>