我有这段代码:
在c#windows窗体中工作正常...但在asp.net中它返回null
var tempCadena = HttpContext.Current.Server.MapPath("~/" + HttpContext.Current.Session["db"] + "/" + "cadena");
System.IO.File.WriteAllText(tempCadena, cadena);
// Digestion SHA1
var tempSha = HttpContext.Current.Server.MapPath("~/" + HttpContext.Current.Session["db"] + "/" + "sha");
var opensslPath = HttpContext.Current.Server.MapPath("~/openssl/bin/openssl.exe");
Process process = new Process();
process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
process.StartInfo.FileName = opensslPath;
process.StartInfo.Arguments = "dgst -sha1 " + tempCadena;
process.StartInfo.UseShellExecute = false;
process.StartInfo.ErrorDialog = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();
string codificado = "";
codificado = process.StandardOutput.ReadToEnd();
process.WaitForExit();
codificado = null我尝试过很多东西而且什么都没有......有人可以帮助我吗?
我尝试将Process更改为ProcessStartInfo并且无法正常工作
答案 0 :(得分:0)
我找到了它:
:tempCadena具有目录的值: D:\ ShamTec MySQL \ 它在文件夹名称中有一个空格 这就是进程返回错误的原因
感谢