在asp.net中显示多页Tiff图像时出错 [英] getting error while displaying multipage Tiff image in asp.net
问题描述
您好b $ b
任何人都可以帮我在浏览器中显示tiff图像而无需缩略图
我的默认代码.aspx是
Hi
Can anybody help me in displaying a tiff image in the browser without thumbnails
My code in default.aspx is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Imaging;
namespace Documentviewer1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "image/tiff";
string filename = HttpRuntime.AppDomainAppPath + @"\" + Request.QueryString["ImageFileName"];
new Bitmap(filename).Save(Response.OutputStream,ImageFormat.Jpeg);
}
}
}
我正在使用
and I am using
<img src =" ~567892.tif alt width=200 height=200/>
我得到了
在执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的更多信息。
异常详细信息:System.ArgumentException:参数无效。
我缺少什么?
任何人都可以提供帮助
Mary
and I am getting
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Parameter is not valid.
what I am missing?
Can anybody help
Mary
推荐答案
尝试像这样调试
修改你的公司de in(逻辑上没有太大区别)
Try to debug like this
modify your code in such ( not a big difference in logic )
string appath = HttpRuntime.AppDomainAppPath + @"\";
string imagename = Request.QueryString["ImageFileName"];
string filename = appath + imagename; // apply break point on this line and check the file name path..
Response.ContentType = "image/tiff";
new Bitmap(filename).Save(Response.OutputStream, ImageFormat.Jpeg);
确保图像存在于该位置。如果图像不可用,则会抛出参数无效
错误。
并检查是否从<$收到了值c $ c>查询字符串。 ..
make sure that the image is present in the location. if the image is not available then this will throw the Parameter is not valid
error.
and also check that the values is received from the query string.
..
这篇关于在asp.net中显示多页Tiff图像时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!