B V

B V

  • 1.9k
  • 19
  • 645

Pdf file content showing junk characters

Mar 4 2021 12:33 PM
I have developed an online portal for recruitment where users upload multiple pdf/word/excel files. The files are getting uploaded successfully, but when i try to view the uploaded files, it always display the junk characters as shown below
  
 
This is occurring only on production server, In localhost it works fine. Below is the code to open pdf files:
 
Dim client As New WebClient()
Dim buffer As [Byte]() = client.DownloadData(flpath)
If buffer IsNot Nothing Then
Response.ContentType = ContentType
Response.AddHeader("content-length", buffer.Length.ToString())
Response.AddHeader("content-disposition", "attachment;filename=" & Guid.NewGuid.ToString)
Response.BinaryWrite(buffer)
Response.Flush()
Response.End()
Is it a server isssue ?
Kindly Help on this 
 
Thnaks 
 
 

Answers (2)