Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# &引用;GDI+;中发生一般性错误&引用;在Windows XP的浏览器中显示图像时出错_C#_Asp.net_Image_Tiff - Fatal编程技术网

C# &引用;GDI+;中发生一般性错误&引用;在Windows XP的浏览器中显示图像时出错

C# &引用;GDI+;中发生一般性错误&引用;在Windows XP的浏览器中显示图像时出错,c#,asp.net,image,tiff,C#,Asp.net,Image,Tiff,在浏览器中显示.tiff图像时出现以下错误 A generic error occurred in GDI+. 我正在将.tiff图像转换为.png,然后在浏览器中显示它们 A generic error occurred in GDI+. 我的代码: Response.ContentType = "image/png"; Response.AddHeader("content-disposition", "filename=" + Request.QueryString["path"]);

在浏览器中显示
.tiff
图像时出现以下错误

A generic error occurred in GDI+.
我正在将
.tiff
图像转换为
.png
,然后在浏览器中显示它们

A generic error occurred in GDI+.
我的代码:

Response.ContentType = "image/png";
Response.AddHeader("content-disposition", "filename=" + Request.QueryString["path"]);

Image img = Image.FromFile(Request.QueryString["path"]);               
      img.Save(Context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);

但是,此错误仅在Windows XP中出现。同样的代码在Windows 7中也可以正常工作。

尝试使用位图进行转换

System.Drawing.
 Bitmap.FromFile(Request.QueryString["path"])
  .Save(Context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
参考: