All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
SQL,SERVER如何减少死锁_mssql学习_编程技术
php中加入播放flv视频代码_php资料_编程技术
DropDownList无限级分类(灵活控制显示形式)_[Asp.Net教程]
asp.net2.0验证控件之验证控件典型应用实例
asp.net2.0生成一个复杂的验证码,背景随机,字体随机,中英文数字随机_[Asp.Net教程]
delphi向一个文件中添加内容
Windows,2003,Server,中DOTNET程序访问COM组件_[Asp.Net教程]
C#,2.0,套接字编程实例初探_[Asp.Net教程]
Asp.Net发送电子邮件程序_[Asp.Net教程]
通过继承ConfigurationSection,在web.config中增加自定义配置_[Asp.Net教程]
Reading number is top 10 pictures
Discharge accidentally Actresses by the breast2
30 beautiful school beauty3
到南昌西站了2
Beauty is thus produced
妹子最好别玩单反
Sora aoi on twitter1
Female model behind the bitterness, often being overcharged3
分手的感悟
机器人也有性生活吗?
再发一张清纯美眉的照片
Download software ranking
Macromedia Dreamweaver 8
变速齿轮3.26
I for your crazy
仙剑奇侠传98硬盘WINXP版
Tram sex maniac 2 (H) rar bag2
Boxer's Top ten classic battle10
The cock of the Grosvenor LTD handsome
C语言教程TXT
dreamweaver8中文版
美女写真1
delv published in(发表于) 2014/1/24 9:07:40 Edit(编辑)
asp.net利用RAR实现文件压缩解压缩_[Asp.Net教程]

asp.net利用RAR实现文件压缩解压缩_[Asp.Net教程]

asp.net利用RAR实现文件压缩解压缩_[Asp.Net教程]

如果服务器上安装了RAR程序,那么asp.net可以调用RAR实现文件压缩与解压缩。


不过要注意的是,由于Web程序不能直接调用客户端的程序(除非用ActiveX,ActiveX几乎被废弃),所以如果要想实现让用户把本地文件用网页解压缩只有把文件上传到服务器上再调用服务器上的RAR压缩,同理要解压缩本地的RAR文件可以把文件上传到服务器解压再拿回来。


本文讲怎么在服务器端的目录解压缩文件!


效果图:

前台代码:

前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>





服务器端解压缩 清清月儿 http://blog.csdn.net/21aspnet/





onClick="Button1_Click" Text="压缩" />
onClick="Button2_Click" Text="解压缩" />




后台代码:


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;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Diagnostics;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
//压缩
String the_rar;
RegistryKey the_Reg;
Object the_Obj;
String the_Info;
ProcessStartInfo the_StartInfo;
Process the_Process;
try
{
the_Reg = Registry.ClassesRoot.OpenSubKey("Applications\WinRAR.exe\Shell\Open\Command");
the_Obj = the_Reg.GetValue("");
the_rar = the_Obj.ToString();
the_Reg.Close();
the_rar = the_rar.Substring(1, the_rar.Length - 7);
the_Info = " a " + " 1.rar " + " " + "C:\1\1.txt";
the_StartInfo = new ProcessStartInfo();
the_StartInfo.FileName = the_rar;
the_StartInfo.Arguments = the_Info;
the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
the_StartInfo.WorkingDirectory = "C:\1";//获取或设置要启动的进程的初始目录。
the_Process = new Process();
the_Process.StartInfo = the_StartInfo;
the_Process.Start();
Response.Write("压缩成功");
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
protected void Button2_Click(object sender, EventArgs e)
{
//解压缩
String the_rar;
RegistryKey the_Reg;
Object the_Obj;
String the_Info;
ProcessStartInfo the_StartInfo;
Process the_Process;
try
{
the_Reg = Registry.ClassesRoot.OpenSubKey("Applications\WinRar.exe\Shell\Open\Command");
the_Obj = the_Reg.GetValue("");
the_rar = the_Obj.ToString();
the_Reg.Close();
the_rar = the_rar.Substring(1, the_rar.Length - 7);
the_Info = " X " + " 1.rar " + " " + "C:\1";
the_StartInfo = new ProcessStartInfo();
the_StartInfo.FileName = the_rar;
the_StartInfo.Arguments = the_Info;
the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
the_Process = new Process();
the_Process.StartInfo = the_StartInfo;
the_Process.Start();
Response.Write("解压缩成功");
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
}


服务器端目录:



客户端解压缩的变通方法:



作者:清清月儿







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.