当前位置: 首页 > news >正文

网站开发收税站长统计app软件

网站开发收税,站长统计app软件,拼多多网站在那里做,永康市网站建设如果服务器上安装了RAR程序,那么asp.net可以调用RAR实现文件压缩与解压缩。 不过要注意的是,由于Web程序不能直接调用客户端的程序(除非用ActiveX,ActiveX几乎被废弃),所以如果要想实现让用户把本地文件用网…

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

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

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

效果图:

 前台代码:
<%...@ 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 runat="server">
    
<title>服务器端解压缩  清清月儿 http://blog.csdn.net/21aspnet/</title>
</head>
<body>
    
<form id="form1" runat="server">
    
<div>
        
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="压缩" />
        
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="解压缩" /></div>
    
</form>
</body>
</html>

 

后台代码:

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)
    
...{
        
//清清月儿 http://blog.csdn.net/21aspnet/
    }

    
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());
        }

    }

}

 

服务器端目录:

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

转载于:https://www.cnblogs.com/hzuIT/articles/784494.html

http://www.lbrq.cn/news/2415799.html

相关文章:

  • 东莞网站推广优化阿里巴巴推广
  • 自学网站建设工资厦门谷歌seo公司有哪些
  • 专业教学资源库网站建设工作万网域名查询官网
  • 源码商城交易平台南京百度关键字优化价格
  • 平度市城乡建设局网站清远seo
  • 怎么做谷歌收录的网站bt磁力库
  • 网站编程脚本语言营销手段和技巧
  • 网站开发难吗如何在百度上做免费推广
  • 委托做的网站版权归属深圳网络推广
  • 单页面网站制作技术百度搜图
  • 简单网站制作教程seo优化几个关键词
  • 两学一做网站网址大全网站优化系统
  • 网站建设技术方案模板亚马逊的免费网站
  • 做网站是用wordpress还是DW沈阳网站关键字优化
  • 今天建设银行网站无法登录seo专员是干嘛的
  • 黄山网站建设哪家好郑州seo建站
  • 怎么制作海报图片上海优化公司
  • 兰州道路建设情况网站深圳百度seo培训
  • 做网站平台的公司有哪些广告公司
  • java 网站开发技术优化设计高中
  • 做中文网站的公司网站推广有哪些方式
  • 现在一般做B2B类网站用vueseo教程视频论坛
  • 上传到网站免费域名 网站
  • 无锡怎么做网站推广销售渠道
  • 做电影资源网站seo网络运营
  • 电子商务网站开发技术路线网站运营策划书
  • 广告网站建设报价长沙市网站制作
  • 三门峡建设环境局网站现在做百度快速收录的方法
  • 建设网站公司哪个好怎么样做网站推广
  • CSS做网站下拉菜单被图片挡住了杭州今天查出多少阳性
  • Spring Boot 集成 RabbitMQ:普通队列、延迟队列与死信队列全解析
  • 金仓数据库:融合进化,智领未来——2025年数据库技术革命的深度解析
  • 5.2.4 指令执行过程
  • 【软件测试】从软件测试到Bug评审:生命周期与管理技巧
  • Android 项目中如何在执行 assemble 或 Run 前自动执行 clean 操作?
  • Linux C 信号操作