如何通过单击链接在另一个浏览器实例中打开页面

Cof*_*ode 2 html browser asp.net-mvc

我有一个链接

<a id="DownloadLink" href='controller/action' target="_blank">Download File</a>
Run Code Online (Sandbox Code Playgroud)

必须在另一个标签页或页面中打开图像.但它让我下载文件.
我的动作看起来像这样

public FileContentResult GetSurveyFile(int Id)
        {
            if (Id == 0)
                return null;
            Survey survey = Repository.GetItem(Id);
            if (survey.File == null)
                return null;

            return File(survey.File.FileContent.ToArray(), survey.File.ContentType,survey.File.Name);
        }
Run Code Online (Sandbox Code Playgroud)

其中内容类型是image/jpeg

怎么了?

Rus*_*ett 5

浏览器如何处理图像文件取决于浏览器/ OS /用户首选项.为了绝对保证它被打开而不是下载,只需将图像包装在和html页面中,其中图像是身体中唯一的东西.