Question

I have this code:

in c# windows form works right...but in asp.net its return 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 I tried many things and nothing...can someone help me please?

I tried to change Process to ProcessStartInfo and doesn't work

Was it helpful?

Solution

I found it:

the: tempCadena has the value to the directory: D:\ShamTec MySQL\ and it has a space in the folder name that's why the process returns error

thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top