uiwebview session problem
NSURL *url = [NSURL URLWithString:@"http://ip/login"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];
NSString *body = [NSString stringWithFormat: @"name=%@&pass=%@", @"phpxiaoxin", @"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"];
[request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];
[request setHTTPMethod: @"POST"];
//Load the request in the UIWebView.
[webView loadRequest:request];
url = [NSURL URLWithString:@"http://ip/hotel/hotelReservationList.action"];
request = [[NSMutableURLRequest alloc]initWithURL:开发者_如何学Python url];
[webView loadRequest:request];
hi all i have a problem with uiwebview cause of session; now first i wan to use a postmethod to login the system then i need to control to redirect to the action of "hotelreservation.action" but the second request is not extend the first session ,so the result is the web system redirect to login page what i should do with uiwebview, i know i can redirect is in web but i do need to control by webview. so anybody can help me ? thanks a lot
You should execute the second request in the UIWebViewDelegate
's webViewDidFinishLoad:
method.
精彩评论