Call Stack Error

G

Gunawan

Hi there,
I am using this code that I have found in the internet to generate excel
output.

Response.Clear();
Response.AddHeader("content-disposition",
"attachment;filename=kirim.xls");
Response.Charset = "";

// If you want the option to open the Excel file without saving than
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";

System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite =
new HtmlTextWriter(stringWrite);

//gv.RenderControl(htmlWrite);
this.RenderControl(htmlWrite);

Response.Write(stringWrite.ToString());
Response.End();


But I've got this error (Exception) bellow when Response.End() issue.
"Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack."

How to correct this issue?

Regards,
Gun
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top