Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does anybody knows how can I apply Response on my class.vb?

Im planning to add download on asp.net

I'm stock with the error "Response is not available in this context"

VB
Response.ContentType = "Application/xmsexcel"
Response.AppendHeader("Content-Disposition", "attachment; filename=Excel.xls")
Response.TransmitFile(Server.MapPath("Excel.xls"))
Posted
Comments
Orcun Iyigun 5-Apr-13 3:00am    
Can this link[^] be a solution to your question?
iMaker.ph 5-Apr-13 3:18am    
Yes it is thanks for the reply :)
iMaker.ph 5-Apr-13 3:21am    
wonder how Can I apply it with this code..

rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.Excel, Response, True, "Excel")
keeps saying thread aborted

this was the my code before and then I change it with the above code..

1 solution

Response is only available on your page behind code page not in the class file cause Response object is returned by server with respect to the server request.

Class files are not requested to the server so you cant get the response on your class file .

It only possible on your Page behind .
 
Share this answer
 
Comments
iMaker.ph 5-Apr-13 20:49pm    
Thanks for the reply

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