I am trying to get an html response from a server(aspx).
NSString *urlstr = [[NSString alloc] initWithFormat:@"http://www.someSiteThatRedirectsWithGetParameters.com?parameter1=1¶meter2=2"];
NSURL *url = [ NSURL URLWithString:urlstr];
NSMutableURLRequest *urlRequest = [ NSURLRequest requestWithURL: url];
NSData data = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
NSURL *lastURL=[response URL];
NSLog(@"Last url %@", lastURL);
I am getting lastURL as www.someSiteThatRedirectsWithGetParameters.com and therefore not getting the html page for the original requested url.
Why is this so and how can I solve this?
EDIT
This is all what I have tried so far : Get the last redirected url in iOS 5? but I am still not able to achieve what I am trying to i.e : get the html page source of the original GET request(going through redirections) having parameters in the url ?