471,349 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

Running a Console App from ASP.Net

I'm trying to encypt a file using PgpCmdLn 6.5.8 from an asp.net page. My
code looks like this:
private String ExecuteProcess(String Arguments)

{

String msg = String.Empty;

try

{

if(this._pgpPath == null || this._pgpPath == String.Empty)

throw new Exception("The path to the Pgp cmdline application must be given!
");

Arguments +=GetSettings();

compiler = new Process();

compiler.StartInfo.FileName = this._pgpPath + "\\pgp.exe";

compiler.StartInfo.Arguments = Arguments;

compiler.StartInfo.UseShellExecute = false;

compiler.StartInfo.CreateNoWindow = true ;

compiler.StartInfo.RedirectStandardOutput = true;

compiler.Start();
DateTime StartTime = DateTime.Now;

compiler.WaitForExit(_wait);

// while((long)((TimeSpan)(DateTime.Now - StartTime)).TotalSeconds < _wait)

// {

// if(compiler.HasExited)

// break;

// }

if(!compiler.HasExited)

compiler.Kill();

msg = " " + compiler.StandardOutput.ReadToEnd();

compiler.Dispose();

if(msg.ToLower().IndexOf("error",0) > 0 ||
msg.ToLower().IndexOf("warning",0) > 0)

{

throw new Exception("Pgp error: Arguments(" + Arguments + ")" );

}

return msg;
}

catch( Exception err)

{

throw new Exception( err.Message + " :: " + msg);

//Cannot find the public key matching userid

}

}

When I run this code from my aspx page I'm prompted for random data: "PGP
needs to generate some random data. This is done by measuring the time
intervals between your keystrokes. Please enter some random text on your
keyboard until the indicator reaches 100%. Press ^D to cancel 0% of required
data "

How can I do this? Can someone give me an example? Thanks in advance.


Jul 21 '05 #1
1 1922
More Info: What I'd like to do is redirect the stdin to enter this random
data. I have tried this but with no luck. Can someone give me an example
of this? In particular - an example where the console application is
prompting for additional input.
"foobar" <es***@inbizservices.com> wrote in message
news:OV**************@TK2MSFTNGP14.phx.gbl...
I'm trying to encypt a file using PgpCmdLn 6.5.8 from an asp.net page. My
code looks like this:
private String ExecuteProcess(String Arguments)

{

String msg = String.Empty;

try

{

if(this._pgpPath == null || this._pgpPath == String.Empty)

throw new Exception("The path to the Pgp cmdline application must be given! ");

Arguments +=GetSettings();

compiler = new Process();

compiler.StartInfo.FileName = this._pgpPath + "\\pgp.exe";

compiler.StartInfo.Arguments = Arguments;

compiler.StartInfo.UseShellExecute = false;

compiler.StartInfo.CreateNoWindow = true ;

compiler.StartInfo.RedirectStandardOutput = true;

compiler.Start();
DateTime StartTime = DateTime.Now;

compiler.WaitForExit(_wait);

// while((long)((TimeSpan)(DateTime.Now - StartTime)).TotalSeconds < _wait)
// {

// if(compiler.HasExited)

// break;

// }

if(!compiler.HasExited)

compiler.Kill();

msg = " " + compiler.StandardOutput.ReadToEnd();

compiler.Dispose();

if(msg.ToLower().IndexOf("error",0) > 0 ||
msg.ToLower().IndexOf("warning",0) > 0)

{

throw new Exception("Pgp error: Arguments(" + Arguments + ")" );

}

return msg;
}

catch( Exception err)

{

throw new Exception( err.Message + " :: " + msg);

//Cannot find the public key matching userid

}

}

When I run this code from my aspx page I'm prompted for random data: "PGP
needs to generate some random data. This is done by measuring the time
intervals between your keystrokes. Please enter some random text on your
keyboard until the indicator reaches 100%. Press ^D to cancel 0% of required data "

How can I do this? Can someone give me an example? Thanks in advance.


Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jeffrey Palermo, MCAD.Net | last post: by
4 posts views Thread by sneffe | last post: by
3 posts views Thread by Kevin L | last post: by
2 posts views Thread by Chris Fink | last post: by
5 posts views Thread by plmanikandan | last post: by
17 posts views Thread by Csaba Gabor | last post: by
2 posts views Thread by tom.sikes | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.