Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
Hi

I have one link button to view file in server . Download File from server.

While click that button i have got the below error .

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.

Please help me to solve this problem .


Thanks
Mohan


I used below lines of Coding inside the update panel


C#
Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName);
Response.TransmitFile(FilePath);
Response.End();
Posted
Updated 13-Sep-12 17:25pm
v2
Comments
Zoltán Zörgő 13-Sep-12 8:53am    
Ok, and what exactly is the code associated with the button? And what is the code that should respond to it on server side?
ZurdoDev 13-Sep-12 9:09am    
It is your C# code that is causing the issue. Please improve the question and add in that code.
V Mohan 14-Sep-12 0:23am    
I am using Update panel . But outside the update panel same code is working fine. Problem is with the update panel.

Simply i use to download the file from server in my link button click event

Please help me to solve the problem .


Code is as below

Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName);
Response.TransmitFile(FilePath);
Response.End();

ZurdoDev 14-Sep-12 7:39am    
Yes, in an updatepanel you cannot overwrite the Repsonse object. That is what is causing your error. You could pull the button outside of the updatepanel and then use jquery's ajax() method to do this.

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