我有一个附带密码的webservices url。当我通过提供正确的密码运行应用程序时,应用程序正在运行,同时当我运行具有错误凭据的应用程序时。该应用程序正在运行,我没有一个想法,以摆脱这个问题了,我的代码是在这里不用..使用NSURL方法登录凭证问题
NSString *post =[[NSString alloc] initWithFormat:@"password=%@",[password text]];
NSLog(@"PostData: %@",post);
NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"http://myexample.com/Accountservice/Secure/ValidateAccess?password=abcd&type=1"]];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
的NSURLRequest * request1 = [[的NSURLRequest页头] initWithURL:[NSURL URLWithString:交] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request1 delegate:self startImmediately:YES];
if(!connection){
NSLog(@"connection failed");
}
else{
NSLog(@"connection succeeded");
}
如果我给密码连接成功显示'abcd'。如果我给wrng密码连接成功显示。你能帮助解决这个问题吗?如果我给wrng密码需要显示警报。提前致谢。
accesscode =“ABCD”和输入=“1” – iPatel 2013-03-12 05:08:49
它们只是附加到安全问题该网址,因为它是网络服务的URL ... – 2013-03-12 05:12:30
这里发布不做任何事情,如果你传递的价值在网址! – 2013-03-12 05:24:13