sathish v

sathish v

  • NA
  • 323
  • 2k

i had a problem in reading pdf from external server .

May 15 2018 3:25 AM
i had changed Server mappath to Resolveurl on string FilePath , it works but it takes too much time too load ,(approximatly 4min to load),why its happning,See below
 
//string FilePath = Server.MapPath("sa.pdf");
 
And changed code is:
  1. string FilePath = ResolveUrl("http://www.textbooksonline.tn.nic.in/Books/Std07/Std07-II-TamEng.pdf");  
  2. WebClient User = new WebClient();  
  3. Byte[] FileBuffer = User.DownloadData(FilePath);  
  4. if (FileBuffer != null)  
  5. {Response.ContentType = "application/pdf";  
  6. Response.AddHeader("content-length", FileBuffer.Length.ToString());  
  7. Response.BinaryWrite(FileBuffer);}  
Thanks In Advance For Who Helps,

Answers (1)