asp.net ÓÃÁ÷µÄ·½Ê½ÏÂÔØÎļþ
//ÒÔÏ´úÂë¸ù¾Ý±ðÈËÎÄÕºÍ×Ô¼ºÕûÀí
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace WebApplication1
{
public partial class DownfFile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// WriteFileÏÂÔØ
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button1_Click(object sender, EventArgs e)
{
string name ="DreamweaverCS3¼òÌåÖÐÎÄÃ⼤»îÂÌÉ«°æ.rar";
string path =Server.MapPath("DreamweaverCS3¼òÌåÖÐÎÄÃ⼤»îÂÌÉ«°æ.rar");
FileInfo fileinfo = new FileInfo(path);
long size = fileinfo.Length;
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + name);
Response.AppendHeader("Content-Length", size.ToString());
Response.AppendHeader("Content-Transfer-Encoding", "binary");
Response.ContentEncoding = System.Text.Encoding.UTF8;//GetEncoding("gb2312");
Response.WriteFile(path,0,size);
Response.Flush();
Response.End();
}
/// <summary>
/// ʹÓÃOutputStream.Write·Ö¿éÏÂÔØÎļþ
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button2_Click(object sender, EventArgs e)
{
string fileName = HttpContext.Current.Server.UrlEncode("DreamweaverCS3¼òÌåÖÐÎÄÃ⼤»îÂÌÉ«°æ.rar");
string filePath = HttpContext.Current.Server.MapPath("DreamweaverCS3¼òÌåÖÐÎÄÃ⼤»îÂÌÉ«°æ.rar");
//Èç¹ûҪдÀàµÄ»°ÓÃHttpResponse h
Ïà¹ØÎĵµ£º
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
¡¡¡¡2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
“<%#....%>” ÕâÊÇÊý¾Ý°ó¶¨£¬ÀïÃæ¿ÉÒÔµ÷ÓÃC#µÄ·½·¨¡£
“<%$....%>" û¼û¹ýÕâ¸ö¡£
“<%@...%>”Õâ¸öÊÇÒ³ÃæÖ¸Áһ°ã·ÅÔÚÿ¸öÒ³ÃæµÄ×²¿£¬¶ÔÒ³ÃæµÄÔËÐнøÐпØÖÆ£¬ÈçÉèÖûº´æ£¬ÒýÓÃÓû§¿Ø¼þ£¬µ¼ÈëÃüÃû¿Õ¼ä==
ÁíÍ⻹ÓÐÒ»¸ö<%= ...%> Õâ¸ö=ºÅºóÒ²¿ÉÒÔµ÷ÓÃC#µÄ·½· ......
IIS 7
IIS7×ÔÉíÓжÔMVCµÄÖ§³Ö£¬²¿Êð·½·¨Í¬ÆäËûweb application»ù±¾Ïàͬ£¬ÐèҪעÒâµÄÊÇ£¬mvc 2.0 applicationÔÚHandler MappingsÀïÃæ»áÓÐMvcHttpHandler£¬Èçͼ£º
ÎÒʹÓõÄÊÇ.net 4.0£¬ÎÒ¿´ÁËÆäËû.net 2.0 µÄweb appliationϵÄHandler Mappings¶¼Ã»ÓÐÕâ¸öhandler maping¡£
×¢Ò⣺.net 3.5ÒÔÏ£¨°üÀ¨£©µÄweb application p ......
@Register : Register a user control or class with alias to this page.
@Import: Import a namespace.
@Reference: Link user controls or other page to complile current page. Ö§³ÖÊý¾Ý¿çÒ³ÃæµÄ´«ËÍ
Ò³Ãæʼþ£ºPreInit(´´½¨·þÎñÆ÷¿Ø¼þ), Init(³õʼ»¯·þÎñÆ÷¿Ø¼þµÄ״̬), InitComplete,PreLoad, Load, Lo ......
¸Õ±ÏÒµ£¬×î½üÔÚ¸ã±ÏÒµÂÛÎÄ¡£
˵Æð±ÏÒµÂÛÎÄÎÒ¾ÍÍ·ÌÛ£¬ÎÒÃÇÈýÈËÒ»×飬±¾À´ÎÒÖ÷ÕÅÓÃC#д£¬Ì×ÓÃÒ»¸öÍâ¹úµÄÄ£ÐÍBalloonShopÔÚÏß¹ºÎïÍøÕ¾£¬C#ÊÇ×ÔѧµÄ¡£µ«ÊÇͬ×éµÄÒ»¸öͬѧVBѧµÃ²»´í£¬ÒªÓÃVB¡£ÎÒÏëÄãÒªÓÃVBдµÄ»°ÎÒÊDz»Ì«¶®£¬ÄÇÖ»ÄÜÄã×Ô¼ºÐ´ºÃÁË£¬ÎÒ×î¶àÒ²¾Í´î°ÑÊÖ¶øÒÑ£¬Ê¡ÐÄÁË£¬ºÎÀÖ¶ø²»ÎªÄØ£¡
×îºó×÷Æ·×ö³öÀ´»¹Ëã²»´í£¬¾Í ......