.net 的web打包安装後由于权限的问题无法读取ACCESS数据库如何用C#来修改权限

解决方案 »

  1.   

    string path = String.Format("{0}database\\printTypeDB.mdb \"c:\\Program  Files\"",this.Context.Parameters["targetdir"]);
    Process process = new Process();
    process.StartInfo.FileName = "cmd.exe";
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardInput = true;
    process.StartInfo.RedirectStandardOutput = true;
    process.StartInfo.RedirectStandardError = true;
    process.StartInfo.CreateNoWindow = false;
    process.Start();
    //修改database 和 error的權限
    process.StandardInput.WriteLine(String.Format("cacls {0}database /t /e /c /g aspnet:f",this.Context.Parameters["targetdir"]));
    process.StandardInput.WriteLine(String.Format("cacls {0}error /t /e /c /g aspnet:f",this.Context.Parameters["targetdir"]));
    //copy 打印控件的數據庫到C\Proram Files目錄下
    process.StandardInput.WriteLine(String.Format("copy {0}database\\printTypeDB.mdb /y \"c:\\Program Files\"",this.Context.Parameters["targetdir"]));
    //取消XP系統下sp2的對127.0.0.1的彈出窗口的阻止
    process.StandardInput.WriteLine("reg add \"HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\New Windows\\Allow\" /v \"127.0.0.1\" /t reg_binary /f");
    process.StandardInput.WriteLine("exit");
    process.WaitForExit();
    process.Close();
      

  2.   

    楼主用什么做的.NET的安装文件,能给小弟介绍一下吗?QQ:158792331