Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
VB
Details: Error parsing near '%PDF-1.2
%??
1 0 ob'

I am getting this above error when trying to open file in asp.net

Code which i am using
string ViewFileName = Server.MapPath(DocumentPath + lblHiddenFileName.Text);
 FileInfo infofile = new FileInfo(ViewFileName);
 string myFile = ViewFileName;
 WebClient myWeb = new WebClient();
 Byte[] myBuff = myWeb.DownloadData(myFile);
 Response.Expires = 0;
 Response.CacheControl = "no-cache";
 Response.AppendHeader("Pragma", "no-cache");
 Response.Buffer = true;
 Response.ContentType = contenttype;//"application/pdf";
  Response.AddHeader("Content-Disposition", "attachment; filename=" + infofile.Name);
 Response.BinaryWrite(myBuff);
Posted
Updated 11-Jan-12 21:17pm
v2
Comments
BobJanova 13-Jan-12 10:13am    
You need to show the client side code that sends the request and attempts to deal with the response, since that's what failing.

Ed: and if you're trying to use Microsoft's magic stuff for this, don't. Just use a link, since the result is a download not a page anyway.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900