login to a website in iphone
<pre><code>i am developing one app which will login to vonage website and do some functions like call froward etc . For that purpose first i am trying to login to vonage website  
</code></pre>

<p>i did these steps </p>

<p>1) Found the login url of vonage  </p>

<blockquote>
  <p><a href="https://secure.vonage.com/vonage-web/public/login.htm" rel="nofollow">https://secure.vonage.com/vonage-web/public/login.htm</a></p>
</blockquote>

<p>2) used livehttpheader addon  to capture outgoing post request data when i clicked sigin </p>

<p>the data i found is </p>

<blockquote>
  <p>username=myusername&amp;password=mypassword&amp;redirectingURL=%2Fwebaccount%2Fdashboard%2Fchoose.htm&amp;frontDoorLogin=&amp;goToSelection=callforwarding&amp;loginsubmit=Sign+In</p>
</blockquote>

<p>after i got my data i started coding in xcode , i dont know what is best way to do it but i searched for sometime then i tried like this </p>

<pre><code>-(IBAction) buttonpressed { 

    NSURL *url = [NSURL URLWithString:@"https://secure.vonage.com/vonage-web/public/login.htm"];

    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
    [request setValue:@"myuser" forKey:@"username"];
    [request setValue:@"mypass" forKey:@"password"];
    [request setValue:@"/webaccount/dashboard/choose.htm" forKey:@"redirectingURL"];
    [request setValue:@"" forKey:@"frontDoorLogin"];
    [request setValue:@"callforwarding" forKey:@"goToSelection"];
    [request setValue:@"Sign+In" forKey:@"loginsubmit"];
    [request setDelegate:self];
    [request startAsynchronous];



}

- (void)requestFinished:(ASIFormDataRequest *)request
{
    // Use when fetching text data
    NSString *responseString = [request responseString];

    UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"Hmm" message:@"http works" delegate:self cancelButtonTitle:@"okay" otherButtonTitles:nil];

    [alert show];
    [alert release];
    NSLog(@"Output = %@",responseString);

}

- (void)requestFailed:(ASIFormDataRequest *)request
{
    NSError *error = [request error];
    UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"fail" message:@"http fails" delegate:self cancelButtonTitle:@"okay" otherButtonTitles:nil];

    [alert show];
    [alert release];
}
</code></pre>

<p>but when i ran app in my simulator it crashed . </p>

<p>am i doing correct way in posting data ? and is there any other way to do this ? </p>

<p>can any one help me in this issue </p>

<p>i am using asihttprequest library </p>

<p>thanks in advance </p>

<p>regards </p>

<p><strong>Edit : My blind mistake i types setvalue instead of setpostvalue  ,this will solve this issue :)</strong> </p>
