asp.netÎļþÏÂÔØ
//TransmitFileʵÏÖÏÂÔØ
protected void Button1_Click1(object sender, EventArgs e)
{
/*
΢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öÐµķ½·¨TransmitFileÀ´½â¾öʹÓÃResponse.BinaryWrite
ÏÂÔØ³¬¹ý400mbµÄÎļþʱµ¼ÖÂAspnet_wp.exe½ø³Ì»ØÊÕ¶øÎÞ·¨³É¹¦ÏÂÔØµÄÎÊÌâ¡£
´úÂëÈçÏ£º
*/
string strFileName = "Èý²¿ÏÐÖÃÉ豸¹ÜÀíϵͳ²Ù×÷ÊÖ²áIEMS.ppt";
Response.ContentType = "application/x-zip-compressed";
//Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
string filename = BLL.Config.PART_EM_UPLOAD_DOC + strFileName;
//BLL.Config.PART_EM_UPLOAD_DOC Ϊ·¾¶ ("D:/EMUploadDoc/")
Response.AddHeader("Content-Disposition", "attachment;filename=" +Server.UrlPathEncode(strFileName));
//Server.UrlPathEncode()½â¾öÎļþÃûµÄÂÒÂëÎÊÌâ.
Response.TransmitFile(filename);
} //WriteFileʵÏÖÏÂÔØ
protected void Button2_Click(object sender, EventArgs e)
&
Ïà¹ØÎĵµ£º
///C#ÖеÄýÌå²¥·ÅÀà
using System;
namespace ConfigTools
{
/// <summary>
/// PlayClass µÄժҪ˵Ã÷¡£
///Ô×÷CSDN,¾±¾ÈËÉÔ¼ÓÐÞ¸Ä
/// </summary>
public class PlayClass
{
public PlayClass()
{
......
±¾ÏµÁÐÎÄÕ»ùÓÚASP.NET MVC Preview5.
ControllerÊÇMVCÖбȽÏÖØÒªµÄÒ»²¿·Ö¡£¼¸ºõËùÓеÄÒµÎñÂß¼¶¼ÊÇÔÚÕâÀï½øÐд¦ÀíµÄ£¬²¢ÇÒ´ÓModelÖÐÈ¡³öÊý¾Ý¡£ÔÚASP.NET
MVC
Preview5ÖУ¬½«ÔÀ´µÄControllerÀàÒ»·ÖΪ¶þ£¬·ÖΪÁËControllerÀàºÍControllerBaseÀà¡£ControllerÀà
¼Ì³Ð×ÔControllerBaseÀ࣬¶øControllerBaseʵÏÖÊÇÁËICont ......
²âÊÔµÄurlµØÖ·ÊÇhttp://www.test.com/testweb/default.aspx, ½á¹ûÈçÏ£º
Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/defa ......
1.ͨ¹ýRewritePathʵÏÖÖØÐ´
URLÖØÐ´¿ÉÒÔͨ¹ý±à³ÌµÄ·½Ê½À´ÊµÏÖ¡£ASP.NETÖеÄContex.RewritePath()·½·¨¿ÉÒÔÈÃÄã´Ó³ÌÐòÖÐʵÏÖÖØÐ´ÇëÇóµÄURL¡£Ò»µ©ÖØÐ´ºó£¬ÏµÍ³½«Ê¹ÓÃеķ¾¶À´¼ÌÐøÖ´ÐÐÕâ¸öÇëÇó¡£
ÔÚGlobal.asaxÎļþµÄApplication_BeginRequest()·½·¨ÖУ¬ÄãÐèÒªÔö¼Ó´úÂëÀ ......