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

ASP.NETÏÂÔØ——word,txt,ͼƬ·½·¨

ASP.NETÏÂÔØ——word,txt,ͼƬ·½·¨
¡¡¡¡±¾ÎÄÖ÷Òª½éÉÜASP.NETÏÂÔØÖîÈçword,txt,ͼƬµÈµÄ·½·¨¡£
¡¡
¡¡  try
¡¡¡¡{
¡¡¡¡FullFileName = Server.MapPath(FileName); //FileName--ÒªÏÂÔصÄÎļþÃû
¡¡¡¡FileInfo DownloadFile= new FileInfo(FullFileName);
¡¡¡¡if(DownloadFile.Exists)
¡¡¡¡{
¡¡¡¡Response.Clear();
¡¡¡¡Response.ClearHeaders();
¡¡¡¡Response.Buffer=false;
¡¡¡¡Response.ContentType="application/octet-stream";
¡¡¡¡Response.AppendHeader("Content-Disposition","attachment;filename="
¡¡¡¡+HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.ASCII));
¡¡¡¡Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
¡¡¡¡Response.WriteFile(DownloadFile.FullName);
¡¡¡¡Response.Flush();
¡¡¡¡Response.End();
¡¡¡¡}
¡¡¡¡else{
¡¡¡¡//Îļþ²»´æÔÚ
¡¡¡¡}
¡¡¡¡}
¡¡¡¡catch{
¡¡¡¡//Îļþ²»´æÔÚ


Ïà¹ØÎĵµ£º

Asp.netµ÷ÓÃRARѹËõÎļþÓë½âѹÎļþÔ´Âë

//ѹËõ
protected void btnY_Click(object sender, EventArgs e)
{
 string rar;
 RegistryKey reg;
 string args;
 ProcessStartInfo procStart;
 Process process;
 try
 {
  reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command"); ......

asp.net È¥µôviewstate

½â¾ö°ì·¨£ºapp_code/ ´æ·ÅÒ»¸öÀà ÓÃÀ´½Ø»ñHTTP
1.´úÂëÈçÏÂ
using System;
using System.IO;
using System.Web;
using System.Text;
using System.Text.RegularExpressions;
/// <summary>
/// Removes whitespace from the webpage.
/// </summary>
public class ViewstateModule : IHttpModule
{
......

asp.net Ò³Ãæ´«Öµ

Ö±½Ó»ñµÃÒ³Ãæ²ÎÊý£º
if(!IsPostBack) {   //ÅжÏÊÇ·ñÊǵÚÒ»´Î¼ÓÔØ´°Ìå
}
if(Page.PreviousPage!=null){                           // ÅжÏÉÏÒ»Ò³ÃæµÄ°´Å¥ÊÇ· ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ