473,508 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2008
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5830
by: David Olive | last post by:
Hi guys, I'm having a bit of a problem getting a VB .NET console app to run happily as a scheduled task. The app itself generates a bunch of word documents on a file share on another server by...
2
4560
by: Jacek | last post by:
Hello! My application has to use external native library writing to stdout and stdin. My goal is to redirect output within running process (no chance to do that in child process - Process class...
2
2425
by: Jeffrey Palermo, MCAD.Net | last post by:
I have some classes that control file processing in c#. The files come from a mainframe and may take some time for each to process. I use the Threadpool to process multiple files at once. Each...
4
821
by: sneffe | last post by:
Hi, im writing a program to keep track of which programs is currently running. I would like to have the caption of running programs displayed in a textbox on my form. I cant seem to find an easy way...
3
1460
by: Kevin L | last post by:
How do I check to see if a particular service is running?
2
5473
by: Chris Fink | last post by:
Using WMI, how do I retrieve the list of running applications on a pc? If you open up task manager and click on the applications tab, I am trying to retrieve the task name and the status. I...
8
4549
by: nadeem_far | last post by:
Hello All, These days I am working on a console application that will register for certain events and do some processing based on the event notification. Now, all the objects are being created...
5
1654
by: plmanikandan | last post by:
Hi, I have written a win32 console application(exname1.exe) which runs for ten minutes.I am calling this exname1.exe from another exe named exname.exe using shellexecuteex.Now from exname.exe...
17
2618
by: Csaba Gabor | last post by:
Is there a way to determine the path to the php executable (as opposed to the script. In other words, I am looking for the path to php.exe or php-win.exe) that is currently running (ie. how was...
2
1758
by: tom.sikes | last post by:
We wrote some code (utility stuff) that is intended to run as part of either a windows service, a console app or a windows app. What I'd like to do is when it is running as a service have it log...
0
7227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.