Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Response is not available in this context.
Source Error:
Line 10: public void Download(string filename)
Line 11: {
Line 12: Response.ContentType = "application/exe";
Line 13: Response.AppendHeader("Content-Disposition", filename);
Line 14: Response.TransmitFile(Server.MapPath("~/Resources/bb.exe"));
I am having this method inside a class, i call this method when I click a button
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class Common: System.Web.UI.Page
{
}
Where am I going wrong
When using the response object from an aspx page, its codebehind class or a
user control, the response object is directly available because all these
derive from the page object.
When using the response object in your own class, the object is not
available, but you can access it:
HttpContext.Current.Response. -> something