ASP.NETʵÏÖ´ÓÊý¾Ý¿âÖжÁȡͼƬµÄ·½·¨
ÔÚASP.NETÖÐ,ÎÒÃÇ¿ÉÒÔÓÃÏÂÃæµÄ·½·¨ÊµÏÖ´ÓÊý¾Ý¿âÖжÁȡͼƬ²¢ÏÔʾÔÚÒ³ÃæÉÏ,·½·¨ÈçÏÂ:
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
String sql="SELECT image from append where id='" + strID + "'";
SqlCommand command=new SqlCommand(sql,conn);
conn.Open();
SqlDataReader dr=command.ExecuteReader();
dr.Read();
byte[] imgdata = (byte[])dr["image"];
Response.BinaryWrite(imgdata);
dr.Close();
conn.Close();
ÔÚÐèÒªÏÔʾͼƬµÄµØ·½,¼ÓÉÏÕâÑùµÄ´úÂë,À´¿ØÖÆͼƬÏÔʾµÄλÖõÈÐÅÏ¢:
<asp:Image ImageUrl="showAP.aspx?id=1" ID="imgLogo" Runat="server"></asp:Image>
ÕâÑù¾ÍʵÏÖÁË´ÓÊý¾Ý¿âÖжÁȡͼƬ²¢ÏÔʾµÄ¹¦ÄÜ.
Ïà¹ØÎĵµ£º
Ò»¡¢Page Àà
Page ÀàÓëÀ©Õ¹ÃûΪ .aspx µÄÎļþÏà¹ØÁª£»ÕâЩÎļþÔÚÔËÐÐʱ±»±àÒëΪ Page ¶ÔÏ󣬲¢±»»º´æÔÚ·þÎñÆ÷ÄÚ´æÖС£Èç¹ûÊÇʹÓôúÂëÒþ²Ø¼¼Êõ´´½¨ Web ´°ÌåÒ³£¬Çë´Ó¸ÃÀàÅÉÉú¡£
Àý£º£¨public partial class _Default : System.Web.UI.Page£©
Page ¶ ......
»ñÈ¡ÇëÇóµÄÒ³µÄHttpApplicationState ¶ÔÏó¡£
Ò»¡¢HttpApplicationState Àà
×÷ÓãºÆôÓà ASP.NET Ó¦ÓóÌÐòÖжà¸ö»á»°ºÍÇëÇóÖ®¼äµÄÈ«¾ÖÐÅÏ¢¹²Ïí¡£
ASP.NET Ó¦ÓóÌÐòµÄ¸ÅÄÊǵ¥¸ö Web ·þÎñÆ÷ÉϵÄij¸öÐéÄâĿ¼¼°Æä×ÓĿ¼·¶Î§ÄÚµÄËùÓÐÎļþ¡¢Ò³¡ ......
Ò»).´´½¨²¿ÊðÏîÄ¿
1. ÔÚ“Îļþ”²Ëµ¥ÉÏÖ¸Ïò“Ìí¼ÓÏîÄ¿”£¬È»ºóÑ¡Ôñ“н¨ÏîÄ¿”¡£
2. ÔÚ“Ìí¼ÓÐÂÏîÄ¿”¶Ô»°¿òÖУ¬Ñ¡Ôñ“ÏîÄ¿ÀàÐÍ”´°¸ñÖеē°²×°ºÍ²¿ÊðÏîÄ¿”£¬È»ºóÑ¡Ôñ“Ä£°å”´°¸ñÖеē°²×°ÏîÄ¿”¡£ÔÚ“Ãû³Æ”¿ò ......
asp.net¶àƵµÀÍøÕ¾¿ª·¢¼Ü¹¹Ç³Îö http://www.cnblogs.com/Kenny-Jiang/archive/2007/07/31/837900.html ±³¾°£º
ÎÒÃÇ´ò¿ªÃÅ»§Íøվʱ£¬ÍùÍù»á¿´µ½ºÜ¶àÅÅÁнôÃܵÄƵµÀÁÐ±í£¬Èç¡°ÐÂÎÅ¡±¡¢¡°²Æ¾¡±¡¢¡°ÓéÀÖ¡±µÈ¡£ÆµµÀΪÍøÕ¾ÌṩÁË·½±ãµÄµ¼º½¹¦ÄÜ¡£
ÄÚÈÝÃèÊö£º
......
<HTML><HEAD>
<TITLE>ÍøÒ³ÌØЧ¹ÛÖ¹|JsCode.CN|---Ò³ÃæÓÒϽǵ¯³öÀàËÆQQ»òMSNµÄÏûÏ¢Ìáʾ</TITLE>
<SCRIPT language=JavaScript>
<!--
/**//*
** ==================================================================================================
**&nbs ......