C# html下载链接在chrome中工作,但重定向到IE中登录!1.

C# html下载链接在chrome中工作,但重定向到IE中登录!1.,c#,html,asp.net-mvc,C#,Html,Asp.net Mvc,此测试页面上的下载链接: chrome下载文件OK(通过asp.net MVC和c#) IE11重定向到登录页面 你知道为什么会这样吗 以下是服务器端mvc代码 public FilePathResult DownloadMedia(int id) { try { string filename = _videoService.GetUrlForDownloadVideo(SessionManager.CurrentUserId

此测试页面上的下载链接:

chrome下载文件OK(通过asp.net MVC和c#)

IE11重定向到登录页面

你知道为什么会这样吗

以下是服务器端mvc代码

 public FilePathResult DownloadMedia(int id)
    {
        try
        {
            string filename = _videoService.GetUrlForDownloadVideo(SessionManager.CurrentUserId, id);
            FileInfo fi = new FileInfo(filename);
            return File(filename, "application/octet-stream", fi.Name);
        }
        catch (Exception ex)
        {
            Helper.StoreErrorLogModel(_logger, ex, "");
            return null;
        }
    }
--
多亏了所有的建议——事实上,它看起来就像是以前的登录或浏览器中的另一个选项卡赋予了Chrome无需登录即可访问的功能。IE的上述代码中出现了一个异常(浏览器重新启动后,chrome也出现了例外)

您提供的链接也将重定向到my chrome浏览器上的登录页面


在您的Chrome浏览器中,它似乎已经通过了您的域的身份验证(或缓存了凭据),因此它直接下载内容。在IE中,您未经身份验证,因此它将重定向到登录页面

使用Chrome我也会被重定向到登录页面。停止重复你的问题。看。你的代码中有异常吗?当你在Chrome中测试时,最好使用一个匿名窗口。这将确保您没有任何缓存在某处的凭据。