我有一個附帶密碼的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