- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个包含 aspImage 控件的网页当我通过图像处理程序从数据库中检索图像时,我可以在 aspImage 控件中显示该图像!但 。 . .问题是当我右键单击图像并单击“将图片另存为”时,我收到此错误消息:正在保存或检索的文件类型已被阻止!我想知道这是 IE 问题还是我的代码有问题?!有什么帮助吗?!
这是我的图像处理程序代码:
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Web;
public class Handler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString);
public void ProcessRequest(HttpContext context)
{
string TableName=context.Session["TableToQuery"].ToString();
string ID=context.Session["ID"].ToString();
SqlCommand comm = new SqlCommand("SELECT * FROM "+ TableName +" WHERE ID=" + ID, conn);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
dr.Read();
context.Response.BinaryWrite((byte[])dr["Image"]);
conn.Close();
}
public bool IsReusable
{
get
{
return false;
}
}
}
这是我展示图像的数据列表:
<asp:DataList ID="DL" runat="server" Width="100%" Height="100%" RepeatColumns="1"
RepeatDirection="Vertical">
<ItemTemplate>
<table style="height: 100%; width: 100%">
<tr style="width: 100%; height: 350px">
<td valign="middle">
<asp:Image ID="IMage" runat="server" ImageUrl='<%# "Handler.ashx?ID=" + Eval("ID") %>' />
</td>
</tr>
<tr style="width: 100%; height: 250px">
<td valign="top">
<asp:TextBox ID="txtDecoded" runat="server" TextMode="MultiLine" Width="316px"
Height="200px" Text='<%#Eval("DecodedString")%>'></asp:TextBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
最佳答案
您没有发送任何 header 来声明内容的 MIME 类型,只是一个 context.Response.BinaryWrite
至少你应该在 BinaryWrite 之前添加这样的东西
context.Response.ContentType = "image/jpeg";
关于c# - : "save picture as" in IE for an image retrieved from database via an image handler 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11807703/
我有一条路线,有两个与之关联的模型,如下所示: App.IndexRoute = Ember.Route.extend({ model: function() { return Emb
这是我的第一个 Python 脚本,所以我认为我做错了什么。但是我在任何教程或示例中都找不到线索。以下代码(可以这么说): import urllib urllib.retrieve("http://
SDK:适用于 Go 0.5.0 的 Apache Beam SDK 我们在 Google Cloud Data Flow 中运行 Apache Beam Go SDK 作业。他们一直工作得很好,直到
我希望简化网站用户在 Adobe Business Catalyst 网站上注册、登录和检索/重置密码的流程。 我已成功使用 AJAX 提交安全区登录表单。我还使用 jQuery.load 从密码
我在 R 中收到以下错误消息: Error in .verify.JDBC.result(r, "Unable to retrieve JDBC result set", : Unable to r
在什么情况下“反文档频率”在信息检索中不起作用? 最佳答案 如果您不希望在系统中权衡稀有术语而不是频繁出现的术语,则可能不希望使用IDF。此外,计算idf是一项昂贵的操作。从以下事实可以明显看出这一点
我正在尝试计算 Average Precision (和 Mean Average Precision )在 Oxford Building image dataset 上. 下面是他们提供的用于计算
有人知道在网站上查找最相关的联系信息的脚本/食谱/库吗? 一些可能的情况: 在个人网页上查找联系电话号码 在博客上查找所有者电子邮件地址 查找联系页面的网址 最佳答案 查看WSO2's Mashup
我看过像“sc2ranks.com”这样的网站,我完全想知道他们是如何获得我只能在游戏中访问的信息的。我的意思是我如何访问星际争霸 II 欧盟天梯?这只是我们必须访问/下载的 URL,还是需要通过注入
我已阅读 Permuterm indexes stanford 网站上的页面,但是我仍然无法弄清楚我们如何从以下地址到达:*X*至 X* . 那么$在哪里? ? 我可以得到这些: For X, loo
考虑以下选定的 html 片段: .......... .......||||||||||||||||||||||||||||||....... 第二行代表用户选择(管道),跨越多个跨度标签。使用 j
我需要从我的 GitHub 私有(private)仓库下载一个文件。因此,按照 GitHub 站点上的说明,我为我的凭据创建了一个 OAuth token 。 然后我执行了这个 PS 脚本: $Web
我有几个扩展 C 的类,并且我需要一个接受 C 类型的任何参数的方法。但是在这个方法中我想知道我正在处理 A 还是 B。 * public A extends C public B extends C
我正在尝试学习 Apache Struts 框架,并且我编写了一个用于进行类(class)注册的小型应用程序,但每当我尝试加载我的应用程序时,它都会抛出以下异常: javax.servlet.Serv
有点跟进 my self-answered question about finding the column names. 在 UniVerse 中,您无法查询文件的所有列,除非文件字典中的 @ 短
我正在为 Dynamics CRM 2011 创建一个插件,以便在用户打开潜在客户时执行。所以我使用 Retrieve 消息来执行插件。 IPluginExecutionContext context
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 6年前关闭。 Improve thi
正在尝试检索文章的文本。我想选择 中的所有文本 ... 我做到了。 但我只想从文章正文中检索文本,而不是整个页面 Document article = Jsoup.connect("html doc
我一直在尝试元素存储,但我被元素存储中的 .retrieve(); 问题所困扰。 文档指出: Element:retrieve actually accepts an optional second
尝试对 facebook 进行图形 API 调用时出现以下错误。我知道我的回调 url 很好,因为当我在 facebook 调试器中测试它时,它可以很好地查看页面。我也在使用 Google App E
我是一名优秀的程序员,十分优秀!