English 中文(简体)
采用ASIHTTPRequest
原标题:Parsing a response for iPhone using ASIHTTPRequest

I m trying to access a website using my login credentials through an iPhone app but the NSLog just shows the site with the login screen...I need the one AFTER the login screen. My code is as follows:

- (IBAction)buttonClicked:(id)sender
{
    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://webportal.factorforms.com/Portal/Form_Login.aspx"]];

    [request setPostValue:[self.usernameField text] forKey:@"Login1$UserName"];
    [request setPostValue:[self.passwordField text] forKey:@"Login1$Password"];

    [request setDelegate:self];
    [request startAsynchronous];
}

- (void)requestFailed:(ASIHTTPRequest *)request {
    NSLog(@"Request failed: %@",[request error]);
}

- (void)requestFinished:(ASIHTTPRequest *)request {
    NSLog(@"Submitted form successfully");
    NSLog(@"Response was:");
    NSLog(@"%@",[request responseString]);
}

My response is just the log in screen....I thought I would be getting the javascript for my actual login. I m not sure what I m doing wrong.

最佳回答

在标识有多种改观之后,您的网址吗? 你们也必须这样做。 ASIHttp可以这样做。 [司法意见]

问题回答

我在试图与网络网站沟通时,遇到同样的问题,并为我做了以下工作:

  1. 包括提交国本身的员额价值,例如

    [Request setPostValue:@“Login” forKey:@“Login1$ CarloinButton”];

  2. 包括网页浏览点的员额价值,因为我认为可以在一些设置中加以验证:

    缩略语

    [request setPostValue:viewState forKey:@ “__VIEWSTATE”];

  3. 包括确认页面活动的员额价值,因为我认为可以在一些设置中加以验证:

    NSString *eventValidation = @"/wEWBQL9m8PyDQKUvNa1DwL666vYDAKnz4ybCAKI7MDFB3FJcnRzxnTY+gW6x83FqZF+QS+6”;

    [Request setPostValue:eventValidation for Key:@ “__EVENTVALIDATION”;

从记忆中,我把这三人都扔进了这个问题上,我的原木后来成功,但如果需要这三个人,我本来应该花掉时间。





相关问题
Google Site Data fetching

Hail! I want to fetch image from NOT PUBLIC Google Site s page. I m using WebClient for this purposes. var uri = new Uri("http://sites.google.com/a/MYDOMAIN.COM/SITENAME/" + "_/rsrc/...

Where do I specify proxy credentials in my WCF client?

I have created a WCF client using channel factory. But I am not able to connect to a server in another machine. I am getting a (407) Prxy Authentication Required exception. WSHttpBinding wsBinding = ...

Detecting login credentials abuse

I am the webmaster for a small, growing industrial association. Soon, I will have to implement a restricted, members-only section for the website. The problem is that our organization membership both ...

热门标签