欢迎来到小编的文章进行学习阅读,想必大家又有很多问题吧,在这里会有你想要收获的答案,请大家慢慢学习吧!计算机编程语言
ASP.NET中通过对话框方式下载文件
1 通过探出对话框提示文件下载或打开
2 通过自定义Header让特定的应用程序打开文件
使用的方法:Response.TransmitFile()
例程:
Response.ContentType = “image/jpeg”;
Response.AppendHeader(“Content-Disposition”,”attachment; filename=SailBig.jpg”);
Response.TransmitFile( Server.MapPath(“~/images/sailbig.jpg”) );
流传送所使用的方法:Response.BinaryWrite()和Response.OutputStream()
例程:
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/ (详细列表)
编程语言(programming language),是用来定义计算机程序的形式语言。它是一种被标准化的交流技巧,用来向计算机发出指令。一种计算机语言让程序员能够准确地定义计算机所需要使用的数据,并精确地定义在不同情况下所应当采取的行动。[1]
最早的编程语言是在电脑发明之后产生的,当时是用来控制提花织布机及自动演奏钢琴的动作。在电脑领域已发明了上千不同的编程语言,而且每年仍有新的编程语言诞生。很多编程语言需要用指令方式说明计算的程序,而有些编程语言则属于声明式编程,说明需要的结果,而不说明如何计算。c语言编程入门
常见问题解决方案:编程语言排行榜上
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(); |
解决方法,再创建一个实例接收从资源文件或者数据库BLOB字段读入的图像内容。
解决方案代码:
以下为引用的内容: Bitmap bmp = this.GetGlobalResourceObject(“Resource”, ”_BitMap”) as Bitmap; Bitmap temp = new Bitmap(bmp); Response.ContentType = “image/jpeg”; Temp.Save(Response.OutputStream, ImageFormat.Jpeg); bmp.Dispose(); temp.Dispose(); Response.End(); |
2、无法直接把PNG图像存入到输出流
原因:PNG是特殊的图片格式
解决方案代码:
以下为引用的内容: Bitmap bmp = this.GetGlobalResourceObject( “Resource”, “_BitMap”) as Bitmap; Bitmap temp = new Bitmap(bmp); MemoryStream ms = new MemoryStream(); Response.ContentType=”image/png”; temp.Save(ms, System.Drawing.Imaging, ImageFormat.Png); Ms.WriteTo(Response.OutputStream); bmp.Dispose(); temp.Dispose(); Response.End(); |
3、解决缓存问题
以下为引用的内容: Response.ContentType=”image/png”; Response.Buffer = false; Response.Clear(); MemoryStream stream1 = new MemoryStream(); // DrawPie method return an Image This.DrawPie(table1).Save(stream1,ImageFormat.Png); Response.BinaryWrite(stream1.ToArray()); Base.OnPreInit(e); |
大家学到了多少?如果意犹未尽,可前往课课家官网直接查看,希望大家获益匪浅哦!!!
¥399.00
¥299.00
¥29.00
¥498.00