c# - InnerException = Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack -


my code is

please give me solution...thank

  bool b = false;   string str=server.mappath("~/files/"+filepath);         //  send file browser       response.addheader("content-type", filetype);       response.addheader("content-disposition", "attachment; filename=" + filename);        response.transmitfile(server.mappath("~/files/" + filepath));         response.flush();       //  httpcontext.current.applicationinstance.completerequest();        response.end();        b = true; 

this notification means thread executing code, , therefore cannot used evaluate expression.

use

 httpcontext.current.applicationinstance.completerequest  

instead of response.end();

response.flush , response.end same thing except response.end stops execution of page, , raises endrequest event.

calls end methods throw threadabortexception exception when current response ends prematurely.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -