设断点查看,id的值总为0,为什么传不过去值啊?
使用ashx需要另外配置别的文件吗?<img src='<%# "genimage.ashx?idid="+DataBinder.Eval(Container.DataItem,"id")%> '>
public class genimage:IHttpHandler
{
public genimage()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public bool IsReusable
{
get{return true;}
} public void ProcessRequest(HttpContext Context)
{
SqlDataReader dr;
int id=Convert.ToInt32(Context.Request["idid"]);
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnString"]);
conn.Open();
string sqlstr="select imgname from bayi_img where id="+id;
SqlCommand comm=new SqlCommand(sqlstr,conn);
dr=comm.ExecuteReader();
string path="upload/"+dr["imgname"].ToString();
Context.Response.ContentType="image/jpg";
//if(Context.Request["thumbnail"]!=null)
//{
Bitmap bmp=new Bitmap(path);
float scale=150.0f/System.Math.Max(bmp.Height,bmp.Width);
Image thumb=bmp.GetThumbnailImage((int)(bmp.Width*scale),(int)(bmp.Height*scale),null,System.IntPtr.Zero);
thumb.Save(Context.Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
bmp.Dispose();
thumb.Dispose();
使用ashx需要另外配置别的文件吗?<img src='<%# "genimage.ashx?idid="+DataBinder.Eval(Container.DataItem,"id")%> '>
public class genimage:IHttpHandler
{
public genimage()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public bool IsReusable
{
get{return true;}
} public void ProcessRequest(HttpContext Context)
{
SqlDataReader dr;
int id=Convert.ToInt32(Context.Request["idid"]);
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnString"]);
conn.Open();
string sqlstr="select imgname from bayi_img where id="+id;
SqlCommand comm=new SqlCommand(sqlstr,conn);
dr=comm.ExecuteReader();
string path="upload/"+dr["imgname"].ToString();
Context.Response.ContentType="image/jpg";
//if(Context.Request["thumbnail"]!=null)
//{
Bitmap bmp=new Bitmap(path);
float scale=150.0f/System.Math.Max(bmp.Height,bmp.Width);
Image thumb=bmp.GetThumbnailImage((int)(bmp.Width*scale),(int)(bmp.Height*scale),null,System.IntPtr.Zero);
thumb.Save(Context.Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
bmp.Dispose();
thumb.Dispose();
解决方案 »
- GridView选择某行中的checkbox让该行的其它checkbox选中并计算
- 关于*.aspx.desiner.cs文件,完全乱了
- mvc3下如何使用asp.net 页面?
- 传值还是传地址
- aspx如何读取文本框的值到一个变量中?
- 一个层的覆盖问题
- 拒绝了对对象 'sale_info'(数据库 'net1958119',所有者 'net1958119')的 SELECT 权限。
- ???在网页上直接打开word/excel文件,能否将word/excel的菜单工具条一起显示出来???
- (100分)问Excel导入Sql数据库
- 怎么开启新的窗口
- 安装.net的问题,请大家帮帮我.
- 行走江湖,大家都曾使过什么兵器,现在最趁手的兵器是什么?
<td width=150 height=150 align=center>
<a id="list__ctl0_Hyperlink1" href="ShowUploadimg.aspx?id=5" target="blank">
<img src='genimage.ashx?idid=5 '>
</a>
</td>
</tr>
<tr>
<td>
<span id="list__ctl0_Label1">日</span>
</td>
</tr>
</table>
</td><td align="Center">
<table>
<tr>
<td width=150 height=150 align=center>
<a id="list__ctl1_Hyperlink1" href="ShowUploadimg.aspx?id=4" target="blank">
<img src='genimage.ashx?idid=4 '>
</a>
</td>
</tr>