首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-04-23 
asp.net制作rar文件时出错代码部分String the_rar  RegistryKey the_Reg  Object the_Obj  String the_

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;系统找不到指定的文件

该怎么处理呢,谢谢了

[解决办法]
检查权限、路径、是否有这个文件。

热点排行