使用Cassini进行SSL身份验证

时间:2011-06-09 14:14:04

标签: ios iis ssl nsurlconnection cassini

我们可以使用以下方法进行超级卡西尼吗?我知道IIS非常好用

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
  return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
  if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
    if ([trustedHosts containsObject:challenge.protectionSpace.host])
      [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];

  [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}

谢谢

1 个答案:

答案 0 :(得分:1)

我不确定Cassini是否具有内置的身份验证级别,但我有点怀疑。我很确定你应该能够使用IIS Express,它将取代Cassini。

查看有关IIS Express的Scott Guthrie's blog post