您现在的位置: 网页制作教程网 >> 网络编程 >> Asp.net 教程 >> ASP.NET 实例教程 >> 文章正文
作者:天极Yesk…
来源:天极Yesky
热度:
2007-6-21 9:55:58
ASP.NET中通过对话框方式下载文件
1 通过探出对话框提示文件下载或打开
2 通过自定义Header让特定的应用程序打开文件
使用的方法:Response.TransmitFile()
例程:
|
以下是引用片段:
|
例程:
以下是引用片段:
Bitmap bmp = wwWebUtils.CornerImage(backcolor, color, c, Radius, Height, Width);
Response.ContentType = “image/jpeg”;
Response.AppendHeader(“Content-Disposition”,”attenment; filename=LeftCorner.jpg”);
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
关于Content Type(MIME Type)的参考URL:
http://www.w3.org/TR/html4/types.html (概述)
http://www.iana.org/assignments/media-types/ (详细列表)
常见问题解决方案:
1、当从资源文件或者数据库BLOB字段载入图像出现错误
错误内容:A generic error occurred in GDI+
代码:
| 以下是引用片段: Bitmap bmp = this.GetGlobalResourceObject(“Resource”,”_BitMap”) as Bitmap; Response.ContentType=”image/jpeg”; bmp.Save(Response.OutputStream, ImageFormat.Jpeg); Response.End(); |
我来说两句:
推荐文章
相关文章