image - 为什么不在 ie 11 和 Firefox 中“将图像另存为”调用操作方法?
问题描述
我的cshtml代码:
<img id="imgCapImage" alt="Captcha" src="@Url.Action("RefreshCaptcha", "Account")" />
我的操作代码:
[HttpGet]
[AllowAnonymous]
public FileContentResult RefreshCaptcha(string id)
{
FileContentResult img = null;
try
{
string rndCode = "";
byte[] fileContentResult = VerificationTextGenerator(ref rndCode);
Session["RandomCode"] = rndCode;
img = new FileContentResult(fileContentResult, "image/gif");
}
catch (Exception)
{}
return img;
}
chrome上一切正常。当我单击“将图像另存为”时,它会调用操作方法,并且由于安全问题,我会刷新验证码以防止第 3 方库解析验证码。但是如果我在ie和firefox中做同样的事情,它不会调用action方法并直接下载图像吗?可能吗?我用谷歌搜索了它,但没有找到。
解决方案
推荐阅读
- gensim - 通过指定单词/主题分布来创建 Gensim 模型
- json - 如何动态地将值传递给组件
- sql - EFCore 模型无效。以多种方式引用另一个类似乎是问题所在?
- macos - Apache多个虚拟主机指向不同的目录
- java - 如何从同一个 Java 项目的 jar 文件中运行 ant 命令?
- haskell - 使用任一时如何对条件进行排序
- node.js - AWS Elasticsearch 和 Cognito - 如何允许 Cognito 用户创建私有索引?
- vue.js - 使用 Nuxt 为 css-loader 扩展 Webpack 的问题
- algorithm - 为什么第一个决策有更好的覆盖测试用例?
- testing - 使用 Intellij 运行测试时“未收到测试事件”