Im trying to open pdf files or other files types like images with the browser but ff and chrome are giving the duplicate content error. I am using the code below to open the files.
Response.Contentype = file.ContentType;
Response.AppendHeader("Content-Disposition",string.Format("inline;filename=\"{0}\"",file.Filename));
return File(file.Data,file.ContentType,file.FileName);
Remove the first 2 lines of your code. They are not needed. The
return File(file.Data, file.ContentType, file.FileName);method already already adds aContentType(because of the second argument) andContent-Dispositionheader toattachment(because of the third argument).If you don’t want set the Content-Disposition header to attachment but
inlinethen remove the third argument: