ÔÚASP.NETÖÐÏÂÔØÎļþ
//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());
&
Ïà¹ØÎĵµ£º
asp.net 佫¶ÔÏóÒýÓÃÉèÖõ½¶ÔÏóµÄʵÀý¡£
¾³£Åöµ½Õâ¸öÎÊÌâ¡£ÎÊÌâµÄÔÒò´ó¸ÅÓÐÒÔϼ¸µã¡£
1¡¢ViewState ¶ÔÏóΪNull¡£
2¡¢DateSet ¿Õ¡£
3¡¢sqlÓï¾ä»òDatebaseµÄÔÒòµ¼ÖÂDataReader¿Õ¡£
4¡¢ÉùÃ÷×Ö·û´®±äÁ¿Ê±Î´¸³¿ÕÖµ¾ÍÓ¦ÓñäÁ¿¡£
5¡¢Î´ÓÃnew³õʼ»¯¶ÔÏó¡£
6¡¢Session¶ÔÏóΪ¿Õ¡£
7¡¢¶Ô¿Ø¼þ¸³Îı¾ÖµÊ±,Öµ²»´æÔÚ
8¡¢Ê¹Óà ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Net.Configuration;
namespace BCore.PubFunction
{
public class MailHandler
{
&n ......
Ê×ÏÈ,ÔÚpageloadÀïдÈëÒÔÏ´úÂë:Response.Write("<script>window.opener=null;window.close();</script>");
Æä´Î,ÔÚheadÀïдÏÂÈçÏÂJS´úÂë: <script language="JavaScript">
<!--
function openwin() { window.open ("Default.aspx", "newwindow", "height=600, width=600, toolbar=no, menubar=n ......
VS2005µ÷ÊÔasp.net³ÌÐòʱ³öÏÖ----Internet Explorer ÎÞ·¨ÏÔʾ¸ÃÒ³Ãæ
ÈçͼËùʾ£º
ǰ¶Îʱ¼ä¿ÉÒÔµ÷ÊԵģ¬ËÖª×òÍíͻȻ²»ÐÐÁË£¬ÕÒÁ˺þã¬ÖÕÓÚÕÒµ½½â¾ö·½°¸¡£ÓõÄÊÇVS2005£¬Îļþϵͳ£¬ÔÚIISÀïÃæÉèÖõϰ£¬¿ÉÒÔÔËÐУ¬´úÂëûÎÊÌ⣬Êý¾Ý¿âÁ¬½ÓûÎÊÌâ¡£
·½°¸Ò»£ºÍ¨¹ýÓÒ»÷ASP.NET Development Server£¬Èçͼ£º
´ò¿ª1£¬ÔÚĬÈÏä¯ÀÀÆ ......
Ê×Ò³£º
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......