How to handle URL redirection with getting parameters in a request?

I am trying to get html response from server (aspx).

NSString *urlstr = [[NSString alloc] initWithFormat:@"http://www.someSiteThatRedirectsWithGetParameters.com?parameter1=1&parameter2=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 get lastURL as www.someSiteThatRedirectsWithGetParameters.com and therefore do not get the html page for the original URL.

Why is this and how can I solve it?

EDIT

That's all I have tried so far: Get the last redirected URL in iOS 5?  but I still can’t achieve what I am trying to do as follows: get the source of the html page of the original GET request (passing the redirect) with the parameters in the url?

+3
source share
2 answers

lastURL www.someSiteThatRedirectsWithGetParameters.com html- , URL-.

, , , , , URL-, , , URL. .

HTTP 303, POST GET. , , . - URL-, , , URL-, .

?

"" . "" - URL-, .

+1

. , redirectURL . URL- , URL- GET. , , , .

0

All Articles