Hello I am new to asp.net mvc.
I have created one class and inherit that class from ActionResult in mvc
like below
public class CSVResult : ActionResult
{
public string filename { get; set; }
public string path { get; set; }
public override void ExecuteResult(ControllerContext context)
{
context.HttpContext.Response.Buffer = true;
context.HttpContext.Response.Clear();
context.HttpContext.Response.AddHeader("content-disposition", "attachment Filename=" + filename);
context.HttpContext.Response.ContentType = "application/vnd.csv";
context.HttpContext.Response.WriteFile(context.HttpContext.Server.MapPath(path));
}
}
in HomeController i have code Like This. I completed with the download.
But i cant understand the more use of ExecuteResult method and
return New& ...
Go to the complete details ...