-(void) startRequest
{
ASIHTTPRequest *request= [[ASIHTTPRequest alloc] initWithURL:[NSURLURLWithString:self.fileurl]];
request.delegate = self;
//cache pdf
[request setDownloadCache:[ASIDownloadCache sharedCache]];
// Always ask the serverif there is an updated version of this resource (using aconditional GET)
[request setCachePolicy:ASIAskServerIfModifiedCachePolicy];
[request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
[request setDownloadDestinationPath:[[ASIDownloadCache sharedCache]pathToStoreCachedResponseDataForRequest:request]];
[self.theRequest startAsynchronous];
}
- (void) requestFinished:(ASIHTTPRequest *)request
{
NSURL*filePathUrl = nil;
NSString *pdfPath = [[ASIDownloadCache sharedCache]pathToCachedResponseDataForURL:request.url];
filePathUrl= [NSURL fileURLWithPath: pdfPath];
[myWebView loadRequest: [NSURLRequest requestWithURL: filePathUrl]];
}
- (void) requestFailed: (ASIHTTPRequest *) request {
[MBProgressHUD hideHUDForView:self.viewanimated:YES];
[Debug logString:[[request error] description]];
AlertWithError([requesterror]);
}