Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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());


Ïà¹ØÎĵµ£º

asp.netÔËÐÐÔ­Àí

Ö÷ÒªÀࣺ
¡¡¡¡System.Web.HttpRuntime
¡¡¡¡System.Web.HttpApplicationFactory
¡¡¡¡System.Web.HttpApplication
¡¡¡¡System.Web.Compilation.BuildManager
¡¡¡¡System.Web.Compilation.ApplicationBuildProvider
¡¡¡¡System.Web.Compilation.BuildProvidersCompiler
¡¡¡¡System.Web.UI.PageHandlerFactory
¡¡¡¡ÇëÇó ......

ASP.NETÃæÊÔÌâ(Ò»)

SP.NETÃæÊÔÌâ
£¨×ª Ô­ÎĵØÖ·http://blog.sina.com.cn/s/blog_524c848901009e7b.html~type=v5_one&label=rela_nextarticle ×÷Õß
ÀîÑóµÄ²©¿Í
http://blog.sina.com.cn/liiyang£©
1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private : ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
prote ......

asp.net »ñµÃ·¾¶

²âÊÔµÄurlµØÖ·ÊÇhttp://www.test.com/testweb/default.aspx,   ½á¹ûÈçÏ£º  
  Request.ApplicationPath:   /testweb  
  Request.CurrentExecutionFilePath:   /testweb/default.aspx  
  Request.FilePath:   /testweb/defa ......

asp.netµÄMISϵͳ

ϵͳ¼òµ¥½éÉÜ£º
    ºÜ±ê×¼µÄÅäÖãºasp.net 2.0+SqlServer 2000 or 2005,һЩͳ¼ÆÍ¼²ÉÓõÄÊÇflash¼¼Êõ~¸Õ±ÏÒµµÄʱºòÔÚÒ»¼Òµç×ÓÕþÎñ¹«Ë¾¹¤×÷ʱ¿ª·¢µÄ£¬ÕâÌ×ϵͳǿ¾ÍÇ¿ÔÚËü²»ÊÇÓ¦ÓÃϵͳ£¬¶øÊÇÒ»¸ö¹¤¾ß£¬¿ÉÒÔÔڴ˹¤¾ß»ù´¡ÉÏ£¬¾­¹ý¶þ´Î¿ª·¢£¬ÑÜÉú³öÂú×ãÕþ¸®²¿ÃÅÐÅÏ¢»¯ÐèÇóµÄÓ¦ÓÃϵͳ£¡£¡
    Õ ......

asp.net »ñÈ¡ÉÏ´«Í¼Æ¬µÄ´óС


System.Drawing.Image imgPhoto = System.Drawing.Image.fromFile("ͼƬ·¾¶Ãû");   
int sourceWidth = imgPhoto.Width;   //ͼƬ¿í¶È
int sourceHeight = imgPhoto.Height;   //ͼƬ¸ß¶È
¿Ø¼þÃû.PostedFile.ContentLength &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ