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

File Download Tips for asp.net


use http header
protected void Page_Load(object sender, EventArgs e)
{
string format = Convert.ToString(ViewData["format"]);
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("·ÑÓñ¨Ïú±í", Encoding.UTF8) + string.Format(".{0}",format));
//²âÊÔÖз¢ÏÖ£ºÈç¹ûÒªÏëÔÚIEÖÐÖ±½Ó´ò¿ªPDF£¬ÉÏÐдúÂ룬²»ÄÜÓУ¡£¡·ñÔò¼´Ê¹¿Í»§¶ËÓÐÉèÖã¬Ò²»áʹÓà Adobe Reader/Acrobat ´ò¿ª
Response.ContentType = string.Format("application/{0}",format);
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.BinaryWrite(ViewData.Model);
Response.Flush();
//prevent render html to client(critical)
Response.End();
  
 
 
 request to doc directly
          Response.Redirect(“http://localhost:2222/Docs/abc.doc”, true);
 
Tips:
  ÖÁÓÚ¿Í»§¶ËʹÓÃä¯ÀÀÆ÷´ò¿ª(µ±È»±ØÐëÒªÏàÓ¦µÄä¯ÀÀÆ÷²å¼þÖ§³Ö)£¬»¹ÊÇÏàÓ¦µÄapplication (MS-Word,Adobe Reader),´ò¿ªÇ°ÊÇ·ñÌáʾÏÂÔØ£¬Server¶ËÊÇÎÞ·¨¿ØÖƵģ¬Õâ¸öºÍÓû§ÉèÖÃÓйØÏµ¡£¼ûͼ
 
 
 
 
 


Ïà¹ØÎĵµ£º

ASP.NETÖÐIfameµÄʹÓÃ

 Iframe±ê¼Ç£¬Óֽи¡¶¯Ö¡±ê¼Ç£¬Äã¿ÉÒÔÓÃËü½«Ò»¸öHTMLÎĵµÇ¶ÈëÔÚÒ»¸öHTMLÖÐÏÔʾ¡£Ëü²»Í¬ÓÚFrame±ê¼Ç×î´óµÄÌØÕ÷¼´Õâ¸ö±ê¼ÇËùÒýÓõÄHTMLÎļþ²»ÊÇÓëÁíÍâµÄHTMLÎļþÏ໥¶ÀÁ¢ÏÔʾ£¬¶øÊÇ¿ÉÒÔÖ±½ÓǶÈëÔÚÒ»¸öHTMLÎļþÖУ¬ÓëÕâ¸öHTMLÎļþÄÚÈÝÏ໥Èںϣ¬³ÉΪһ¸öÕûÌ壬ÁíÍ⣬»¹¿ÉÒÔ¶à´ÎÔÚÒ»¸öÒ³ÃæÄÚÏÔʾͬһÄÚÈÝ£¬¶ø²»±ØÖظ´Ð´ÄÚÈ ......

¿ªÔ´Ò»¸öASP.NET¼Ç¼**.LOGµÄÀà

 using System;
using System.Collections.Generic;
using System.Text;
namespace PublicClass
{
    public static class Log
    {
        public static void WriteLine(string line)
        {
......

ASP.NET

      HyperLink Web ·þÎñÆ÷¿Ø¼þ¿ÉÔÚÍøÒ³ÉÏ´´½¨Á´½Ó£¬Ê¹Óû§¿ÉÒÔÔÚÓ¦ÓóÌÐòÖеÄÒ³¼äÒÆ¶¯¡£
 
Ò»¡¢±³¾°
ʹÓà HyperLink ¿Ø¼þµÄÖ÷ÒªÓŵãÊÇ¿ÉÒÔÔÚ·þÎñÆ÷´úÂëÖÐÉèÖÃÁ´½ÓÊôÐÔ¡£ÀýÈ磬Äú¿ÉÒÔ¸ù¾ÝÒ³ÃæÖеÄÌõ¼þ¶¯Ì¬¸ü¸ÄÁ´½ÓÎı¾»òÄ¿±êÒ³¡£
°²È«ËµÃ÷£º Ó볬Á´½ÓÏà¹ØÁªµÄ URL ¿ÉÄܻᱻÓû§¶ñÒâ´Û¸ ......

ASP.NETµÄʵÓôúÂë

1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º

´«ËͲÎÊý£º
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryStrin ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ