473,586 Members | 2,695 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._pgpPat h == null || this._pgpPath == String.Empty)

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

Arguments +=GetSettings() ;

compiler = new Process();

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

compiler.StartI nfo.Arguments = Arguments;

compiler.StartI nfo.UseShellExe cute = false;

compiler.StartI nfo.CreateNoWin dow = true ;

compiler.StartI nfo.RedirectSta ndardOutput = true;

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

compiler.WaitFo rExit(_wait);

// while((long)((T imeSpan)(DateTi me.Now - StartTime)).Tot alSeconds < _wait)

// {

// if(compiler.Has Exited)

// break;

// }

if(!compiler.Ha sExited)

compiler.Kill() ;

msg = " " + compiler.Standa rdOutput.ReadTo End();

compiler.Dispos e();

if(msg.ToLower( ).IndexOf("erro r",0) > 0 ||
msg.ToLower().I ndexOf("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 2014
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***@inbizser vices.com> wrote in message
news:OV******** ******@TK2MSFTN GP14.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._pgpPat h == null || this._pgpPath == String.Empty)

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

Arguments +=GetSettings() ;

compiler = new Process();

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

compiler.StartI nfo.Arguments = Arguments;

compiler.StartI nfo.UseShellExe cute = false;

compiler.StartI nfo.CreateNoWin dow = true ;

compiler.StartI nfo.RedirectSta ndardOutput = true;

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

compiler.WaitFo rExit(_wait);

// while((long)((T imeSpan)(DateTi me.Now - StartTime)).Tot alSeconds < _wait)
// {

// if(compiler.Has Exited)

// break;

// }

if(!compiler.Ha sExited)

compiler.Kill() ;

msg = " " + compiler.Standa rdOutput.ReadTo End();

compiler.Dispos e();

if(msg.ToLower( ).IndexOf("erro r",0) > 0 ||
msg.ToLower().I ndexOf("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
5843
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 reading from a template file and inserting text at bookmark locations (with details pulled from a table in the database). I'm running the app under a...
2
4571
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 redirection is useless in that case) and I would like to do it without reverting to C-run time library P/Invoke calls. Any ideas how to do that?
2
2434
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 instance of the file processor is spawned in its own AppDomain to isolate it (I'm using a separate AppDomain for a valid reason, so this thread isn't...
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 to do this in vb.net. Does anybody have a piece of code that can help me? Thanks
3
1465
by: Kevin L | last post by:
How do I check to see if a particular service is running?
2
5482
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 looked high and low in the WMI documentation and unable to find a class that returns this info. Any help is appreciated. #region List all properties...
8
4557
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 in main(). Once the main exists the program ends. Here is what I want to do.
5
1661
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 coding i have to check whether exname1.exe is already running or not.How to find whether a win32 console application is already runing or not from...
17
2631
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 this script called) on Windows (I'm on Win XP Pro)? WScript/CScript (when programming in VBScript) allow this, for example. Failing that, is there...
2
1769
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 exceptions to the event log, when as a console app, write them to the Console, and when running as a windows app. raise an event. Anybody have any...
0
7908
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8199
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6606
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3835
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2343
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 we have to send another system
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.