Reputation: 1482
I have a Controller action for download file. And after download I trying to redirect to Index view of the same controller. But it is not redirecting
here is my download Action
public ActionResult Download(MemoryStream docStream)
{
byte[] bytes = docStream.ToArray();
docStream.Close();
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + DocumentInfo.DocumentName + "");
Response.AddHeader("Content-Length", bytes.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(bytes);
return View("~/Views/DocumentDownload/Index.cshtml");
}
Can any one help why it is not redirecting . Thanks in advance
Upvotes: 0
Views: 171
Reputation: 480
Just add the name "Index" inside view. E.g.
return View("Index");
Upvotes: 0