asp.net Ö±½Ó ´ÓÊý¾Ý¿â ÏÂÔØ Îļþ
µ±ÎÒÃÇÏëÒª´ÓÍøÉÏÏÂÔØÎļþʱ£¬Í¨³£µÄ×ö·¨ÊÇÔÚ·þÎñÆ÷ÉϵÄij¸öĿ¼ÏÂÉú³ÉÒ»¸öÎļþ¡£
protected void DownloadFile(string filename)
{
string saveFileName = "test.xls";
int intStart = filename.LastIndexOf("\\") + 1;
saveFileName = filename.Substring(intStart, filename.Length - intStart);
Response.Clear();
Response.Charset = "utf-8";
Response.Buffer = true;
this.EnableViewState = false;
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + saveFileName);
Response.WriteFile(filename);
Response.Flush();
Response.Close();
Response.End();
}
µ«»á´æÔÚÕâÑùµÄÇé¿ö£¬Ö±½Ó´ÓÊý¾Ý¿âÖÐÏÂÔØͼƬ¡£
ÆäʵÔÀíºÜ¼òµ¥¡£¾ÍÊÇÓÃMemoryStream´úÌæFileStream¡£ÓÐÒ»µãÐèҪעÒâ¾ÍÊÇhttpÍ·µÄ¸ñʽҪÉèÖÃÕýÈ·¡£ byte[] pic = //´ÓÊý¾Ý¿â·µ»ØµÄͼƬ
MemoryStream ms = new MemoryStream(pic);
System.Drawing.Image img = null;
Graphics g =null;
try
{
img = new Bitmap(new MemoryStream(pic));
g= Graphics.fromImage(img);
Font objfont = new Font("Verdana", 12, FontStyle.Bold);
Brush objbrush = Brushes.Red;
Rectangle rect = new Rectangle(150, 550, 200, 50);
g.DrawString("Ìí¼ÓÎÄ×Ö", objfont, objbrush, rect);
img.Save(ms, ImageFormat.Bmp);
}
catch { }
finally
{
if (img != null) img.Dispose();
if (g!= null) g.Dispose();
}
byte[] newbmp = ms.ToArray();
ms.Close();
ms = new MemoryStream(newbmp);
Response.Clear();
Response.AddHeader("Content-type", "binary/octet-stream");
Response.AddHeader("Content-Length", pic.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename="+pic.Length.ToString()+".bmp; size=" + pic.Length.ToString());
Ïà¹ØÎĵµ£º
MD5µÄÈ«³ÆÊÇMessage-Digest Algorithm 5£¨ÐÅÏ¢-ÕªÒªËã·¨£©£¬ÔÚ90Äê´ú³õÓÉMit Laboratory for Computer ScienceºÍRsa data security incµÄRonald l. rivest¿ª·¢³öÀ´£¬¾md2¡¢md3ºÍmd4·¢Õ¹¶øÀ´¡£ËüµÄ×÷ÓÃÊÇÈôóÈÝÁ¿ÐÅÏ¢ÔÚÓÃÊý×ÖÇ©ÃûÈí¼þÇ©Êð˽ÈËÃܳ×Ç°±»"ѹËõ"³ÉÒ»ÖÖ±£Ãܵĸñʽ£¨¾ÍÊÇ°ÑÒ»¸öÈÎÒⳤ¶ÈµÄ×Ö½Ú´®±ä»»³ÉÒ»¶¨³¤µÄ´óÕ ......
1¡¢DateTime Êý×ÖÐÍ
System.DateTime currentTime=new System.DateTime();
1.1 È¡µ±Ç°ÄêÔÂÈÕʱ·ÖÃë
currentTime=System.DateTime.Now;
& ......
ËäÈ»ÎÒ²»Ï²»¶ÌÖÂÛÌ«¶àÀíÂÛ¸ÅÄîÉϵĶ«Î÷£¬µ«¸÷λ“ש¼Ò”»¹ÊÇÌá³öÁ˺ܶà·Ç³£ÓÐÕë¶ÔÐÔµÄÒâ¼û£¬Íû´ËÌû²»Òª³ÉΪ¿Úˮս²ÅºÃ....ÏÖ´ðÒÉÈçÏ£¨Óкܶà¸öÈËÀí½â£¬²»Ò»¶¨ÕýÈ·£©£º
ש¼ÒÒâ¼ûÇë²Î¼û£ºAsp.Net´óÐÍÏîĿʵ¼ùϵÁе¼º½
ΪʲôѡÔñNHibernate
ÀíÓÉ1£º¶ÔÏó¹ØϵӳÉä¼¼Êõ£¨ORM£©µÄ×îÖ÷ҪĿµÄÊÇΪÁ˽â¾ö¹ØϵÐÍÊý¾Ý¿âÓ ......
×î½ü¿ª·¢ÖÐÔÚÒ³ÃæÖ®¼ä´«µÝÖµµÄ¹ý³ÌÖУ¬¶à´¦Ó¦ÓÃÁ˳¬Á´½Ó´«ÖµµÄ·½Ê½¡£µ«Êǵ±´«µÝµÄ²ÎÊýÖк¬ÓÐÖÐÎÄ×Ö·ûʱ£¬ÔÚµ÷ÓÃRequest.QueryString[]·½·¨½ÓÊÕ²ÎÊýʱ£¬×ÜÊdzöÏÖ´íÎ󣬶øÇÒ´íÎóµÄ³öÏÖ×ÜÊÇËæ»úµÄ¡£±íÏÖΪ½ÓÊÕµÄÖÐÎIJÎÊý²»È«£¬ºó¼ÓͨÅä·û“£¿”£¬»òÕß°ÑÖÐÎIJÎÊýºóµÄÄǸö²ÎÊýºÍÖÐÎIJÎÊý»ìÔÚÒ»Æ𣬲»¼ÓÇø·Ö¡£
& ......