当前位置: 代码迷 >> ASP.NET >> asp.net制作rar文件时出错解决思路
  详细解决方案

asp.net制作rar文件时出错解决思路

热度:9271   发布时间:2013-02-25 00:00:00.0
asp.net制作rar文件时出错
代码部分  
 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 " + " " + @"d:\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 = @"d:\1";//获取或设置要启动的进程的初始目录。
   the_Process = new Process();
   the_Process.StartInfo = the_StartInfo;
   the_Process.Start();
   Response.Write("压缩成功");
   }
   catch (Exception ex)
   {
   Response.Write(ex.ToString());
   }
运行的时候,页面显示压缩成功,但winrar诊断信息提示:d:\1\1无法打开d:1\1.txt;系统找不到指定的文件

该怎么处理呢,谢谢了

------解决方案--------------------------------------------------------
检查权限、路径、是否有这个文件。
  相关解决方案