ASP.Net Form中的post方法,但没有数据发送到服务器

时间:2013-07-14 05:27:57

标签: ios objective-c afnetworking

我正在使用AFNetworking向服务器发送帖子请求, 请求成功,但没有数据发送到服务器。 响应字符串是html表单本身和 表单填入我发送给服务器的值。

以下是代码

 NSURL *url = [NSURL URLWithString:@"http://www.example.com"];
 AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];

 NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"", @"__EVENTTARGET",
                            @"", @"__EVENTARGUMENT",
                            @"", @"__LASTFOCUS",
                            self.VIEWSTATE, @"__VIEWSTATE",
                            self.subject.text, @"ctl00$ContentPlaceHolder1$messagesubject",
                            self.message.text, @"ctl00$ContentPlaceHolder1$messagetext",
                            @"yes", @"ctl00$ContentPlaceHolder1$btn_Submit",
                            nil];
[httpClient postPath:@"/post.aspx" parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {

        NSString *responseStr = [[NSString alloc] initWithData:operation.responseData encoding:NSUTF8StringEncoding];

        NSLog(@"Request Successful, response '%@'", responseStr);

    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

        NSLog(@"[HTTPClient Error]: %@", error.localizedDescription);            

    }];

任何想法?

0 个答案:

没有答案