ÓÃC#(ASP.NET)ÔõôʵÏÖÎļþÏÂÔع¦ÄÜ
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//TransmitFileʵÏÖÏÂÔØ
protected void Button1_Click(object sender, EventArgs e)
{
/*
΢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öеķ½·¨TransmitFileÀ´½â¾öʹÓÃResponse.BinaryWrite
ÏÂÔس¬¹ý400mbµÄÎļþʱµ¼ÖÂAspnet_wp.exe½ø³Ì»ØÊÕ¶øÎÞ·¨³É¹¦ÏÂÔصÄÎÊÌâ¡£
´úÂëÈçÏ£º
*/
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=z.zip");
string filename = Server.MapPath("DownLoad/z.zip");
Response.TransmitFile(filename);
}
//WriteFileʵÏÖÏÂÔØ
protected void Button2_Click(object sender, EventArgs e)
{
/*
using System.IO;
*/
string fileName ="asd.txt";//¿Í»§¶Ë±£´æµÄÎļþÃû
string filePath=Server.MapPath("DownLoad/aaa.txt");//·¾¶
FileInfo fileInfo = new FileInfo(filePath);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(fileInfo.FullName);
Response.Flush();
Response.End();
}
//WriteFile·Ö¿éÏÂÔØ
protected void Button3_Click(object sender, EventArgs e)
{
string fileName = "aaa.txt";//¿Í»§¶
Ïà¹ØÎĵµ£º
¶Ô“Ìí¼Ó”¡¢“Ìá½»”¡¢“±£´æ”¡¢“¸üДµÈ°´Å¥ÐèÒª¶ÔÊý¾Ý¿â½øÐÐд²Ù×÷µÄ°´Å¥£¬Ò»¶¨ÒªÔÚÒ³Ãæ³õʼ»¯Ê±¼ÓÔؽű¾£¬·ÀÖ¹¶à´ÎÖظ´µã»÷£¬ÀýÈ磺
protected void Page_Load(object sender, EventArgs e)
{
//.net 2.0ÒÔÉÏ
......
ÅäÖÃiis6½â¾öÔËÐÐasp.net mvcÏîÄ¿“ÎÞ·¨ÕÒµ½¸ÃÒ³”µÄ´íÎó
ÔÚiis6ÔËÐÐasp.net mvc ÏîĿʱ£¬Èç¹û³öÏÖ“ÎÞ·¨ÕÒµ½¸ÃÒ³”µÄÌáʾ£¬¼´404´íÎó£¬ÄÇôÓпÉÄÜÊÇiisûÓÐÉèÖú㬰´ÏÂÃæ²Ù×÷¿ÉÒÔ½â¾ö£º
´ò¿ªiis¹ÜÀíÆ÷£¬ÓÒ»÷ÏàÓ¦µÄÍøÕ¾½Úµã£¬Ñ¡Ôñ“ÊôÐÔ”¿ì½Ý²Ëµ¥£¬µ¯³öÊôÐÔ¶Ô»°¿ò£¬Ñ¡Ôñ“Ö÷Ŀ¼&rd ......
<asp:DropDownList ID="compactType" runat="server" AutoCallBack="True" Width="153px"> </asp:DropDownList>
<?xml version="1.0" encoding="utf-8" ?>
<roots>
<root>
<id>1</id>
<Culture> ......
<script type="text/javascript">
var loginName,checkUN,password,confirmPwd,email,subBtn,userName,checkTel,tel;
$(init);
function init()
{
loginName = $("#loginName");
loginName.bind("blur",checkUserName);
password = $("#password"); ......