HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=Report.xlsx");
HttpContext.Current.Response.TransmitFile(ExcelFilePath);
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.End();
Above code downloads excel file in the browser, but in case of pdf files its work as intended & opens it browser itself.