473,320 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Diagnostics.Process class and ASP.NET

BCM
In a simple console app the following few lines open up an Acrobat file
without a hitch:

Process p = new Process();
p.StartInfo.FileName = @"C:\test.pdf";
p.Start();

But the same code in an ASP.NET app does NOTHING. No error message, not
anything at all. In fact, if I add the following line after process.Start:

.......
p.Start();
Response.Write(p.Responding.ToString());

SOMETIMES it returns True, but more often I DO get an error, which states
that "Process has exited, so the requested information is not available."

Now I've given the ASPNET user read rights on the file, but I can't think of
anything else that might be precluding the file from opening. Any ideas?
Thanks in advance!
Jul 21 '05 #1
6 1839
So, if a user is thousands miles away from web server where you ASP.NET app
is hosted, yo still want to start Abode Reader on the server and ask the
user to COME OVER to look at it?

Sure, you can run some desktop app on the server, if the ASP.NET account is
assigned proper permission, but it is generally a bad thing to do: what if a
thousand users want to do the same thing in about the same time (or in a
short time span), can the server afford to start a thousand Adobe Reader
instances without crashing?

What you want to do have client browser sent a request for a *.pdf file to
the web server, your ASP.NET page then have the server streams back a *.pdf
file to the user's browser. The bowser then starts Adobe Reader (inside the
browser) on the client machine, if the browse is capable of doing that (IE,
Netscape do).
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
In a simple console app the following few lines open up an Acrobat file
without a hitch:

Process p = new Process();
p.StartInfo.FileName = @"C:\test.pdf";
p.Start();

But the same code in an ASP.NET app does NOTHING. No error message, not
anything at all. In fact, if I add the following line after process.Start:

......
p.Start();
Response.Write(p.Responding.ToString());

SOMETIMES it returns True, but more often I DO get an error, which states
that "Process has exited, so the requested information is not available."

Now I've given the ASPNET user read rights on the file, but I can't think of anything else that might be precluding the file from opening. Any ideas?
Thanks in advance!

Jul 21 '05 #2
So, if a user is thousands miles away from web server where you ASP.NET app
is hosted, yo still want to start Abode Reader on the server and ask the
user to COME OVER to look at it?

Sure, you can run some desktop app on the server, if the ASP.NET account is
assigned proper permission, but it is generally a bad thing to do: what if a
thousand users want to do the same thing in about the same time (or in a
short time span), can the server afford to start a thousand Adobe Reader
instances without crashing?

What you want to do have client browser sent a request for a *.pdf file to
the web server, your ASP.NET page then have the server streams back a *.pdf
file to the user's browser. The bowser then starts Adobe Reader (inside the
browser) on the client machine, if the browse is capable of doing that (IE,
Netscape do).
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
In a simple console app the following few lines open up an Acrobat file
without a hitch:

Process p = new Process();
p.StartInfo.FileName = @"C:\test.pdf";
p.Start();

But the same code in an ASP.NET app does NOTHING. No error message, not
anything at all. In fact, if I add the following line after process.Start:

......
p.Start();
Response.Write(p.Responding.ToString());

SOMETIMES it returns True, but more often I DO get an error, which states
that "Process has exited, so the requested information is not available."

Now I've given the ASPNET user read rights on the file, but I can't think of anything else that might be precluding the file from opening. Any ideas?
Thanks in advance!

Jul 21 '05 #3
BCM
Thanks: I should have made it explicit that I WANT the file to open on the
server, not the client. The file itself has an embedded script that changes
field contents upon opening, by connecting to a database via a DSN on the
server. Right after the .pdf has been opened and thus changed, I want to
direct the browser to it.
"Norman Yuan" <no****@nowhere.no> wrote in message
news:e1****************@TK2MSFTNGP12.phx.gbl...
So, if a user is thousands miles away from web server where you ASP.NET app is hosted, yo still want to start Abode Reader on the server and ask the
user to COME OVER to look at it?

Sure, you can run some desktop app on the server, if the ASP.NET account is assigned proper permission, but it is generally a bad thing to do: what if a thousand users want to do the same thing in about the same time (or in a
short time span), can the server afford to start a thousand Adobe Reader
instances without crashing?

What you want to do have client browser sent a request for a *.pdf file to
the web server, your ASP.NET page then have the server streams back a *.pdf file to the user's browser. The bowser then starts Adobe Reader (inside the browser) on the client machine, if the browse is capable of doing that (IE, Netscape do).
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
In a simple console app the following few lines open up an Acrobat file
without a hitch:

Process p = new Process();
p.StartInfo.FileName = @"C:\test.pdf";
p.Start();

But the same code in an ASP.NET app does NOTHING. No error message, not
anything at all. In fact, if I add the following line after process.Start:
......
p.Start();
Response.Write(p.Responding.ToString());

SOMETIMES it returns True, but more often I DO get an error, which states that "Process has exited, so the requested information is not available."
Now I've given the ASPNET user read rights on the file, but I can't
think of
anything else that might be precluding the file from opening. Any ideas?
Thanks in advance!


Jul 21 '05 #4
BCM
Thanks: I should have made it explicit that I WANT the file to open on the
server, not the client. The file itself has an embedded script that changes
field contents upon opening, by connecting to a database via a DSN on the
server. Right after the .pdf has been opened and thus changed, I want to
direct the browser to it.
"Norman Yuan" <no****@nowhere.no> wrote in message
news:e1****************@TK2MSFTNGP12.phx.gbl...
So, if a user is thousands miles away from web server where you ASP.NET app is hosted, yo still want to start Abode Reader on the server and ask the
user to COME OVER to look at it?

Sure, you can run some desktop app on the server, if the ASP.NET account is assigned proper permission, but it is generally a bad thing to do: what if a thousand users want to do the same thing in about the same time (or in a
short time span), can the server afford to start a thousand Adobe Reader
instances without crashing?

What you want to do have client browser sent a request for a *.pdf file to
the web server, your ASP.NET page then have the server streams back a *.pdf file to the user's browser. The bowser then starts Adobe Reader (inside the browser) on the client machine, if the browse is capable of doing that (IE, Netscape do).
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
In a simple console app the following few lines open up an Acrobat file
without a hitch:

Process p = new Process();
p.StartInfo.FileName = @"C:\test.pdf";
p.Start();

But the same code in an ASP.NET app does NOTHING. No error message, not
anything at all. In fact, if I add the following line after process.Start:
......
p.Start();
Response.Write(p.Responding.ToString());

SOMETIMES it returns True, but more often I DO get an error, which states that "Process has exited, so the requested information is not available."
Now I've given the ASPNET user read rights on the file, but I can't
think of
anything else that might be precluding the file from opening. Any ideas?
Thanks in advance!


Jul 21 '05 #5
What Norman is suggesting was that opening this type of thing server side is
a bad thing to do, whether you want to or not. Certain things can be
invoked with process.start in asp.net, things that spawn windows typically
can't - and some things are simply not suitabl for running on wb servers, to
make it happen you have to impersonate a user who does have that privalege -
and the asp.net account typically wont have this. You will need to read up
a bit more on the asp.net user to better understand how to alter the
security in machine.config to suit your needs.

One correct approach would be to create a server side process, perhaps using
a winservice to do the work for you, so if it dies it doesn't bring down
your web application. Your remote clients would submit requests with
sufficient data to queue and start a job running, with a simple meta refresh
checking if the work had been completed. You can drive all of this from a
simple database. This reduces any risk against your web server and could
be offloaded to another server if neccessary.

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
Thanks: I should have made it explicit that I WANT the file to open on the
server, not the client. The file itself has an embedded script that changes field contents upon opening, by connecting to a database via a DSN on the
server. Right after the .pdf has been opened and thus changed, I want to
direct the browser to it.
"Norman Yuan" <no****@nowhere.no> wrote in message
news:e1****************@TK2MSFTNGP12.phx.gbl...
So, if a user is thousands miles away from web server where you ASP.NET app
is hosted, yo still want to start Abode Reader on the server and ask the
user to COME OVER to look at it?

Sure, you can run some desktop app on the server, if the ASP.NET account

is
assigned proper permission, but it is generally a bad thing to do: what if a
thousand users want to do the same thing in about the same time (or in a
short time span), can the server afford to start a thousand Adobe Reader
instances without crashing?

What you want to do have client browser sent a request for a *.pdf file to the web server, your ASP.NET page then have the server streams back a

*.pdf
file to the user's browser. The bowser then starts Adobe Reader (inside

the
browser) on the client machine, if the browse is capable of doing that

(IE,
Netscape do).
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
In a simple console app the following few lines open up an Acrobat file without a hitch:

Process p = new Process();
p.StartInfo.FileName = @"C:\test.pdf";
p.Start();

But the same code in an ASP.NET app does NOTHING. No error message, not anything at all. In fact, if I add the following line after

process.Start:
......
p.Start();
Response.Write(p.Responding.ToString());

SOMETIMES it returns True, but more often I DO get an error, which states that "Process has exited, so the requested information is not available."
Now I've given the ASPNET user read rights on the file, but I can't

think
of
anything else that might be precluding the file from opening. Any ideas? Thanks in advance!



Jul 21 '05 #6
What Norman is suggesting was that opening this type of thing server side is
a bad thing to do, whether you want to or not. Certain things can be
invoked with process.start in asp.net, things that spawn windows typically
can't - and some things are simply not suitabl for running on wb servers, to
make it happen you have to impersonate a user who does have that privalege -
and the asp.net account typically wont have this. You will need to read up
a bit more on the asp.net user to better understand how to alter the
security in machine.config to suit your needs.

One correct approach would be to create a server side process, perhaps using
a winservice to do the work for you, so if it dies it doesn't bring down
your web application. Your remote clients would submit requests with
sufficient data to queue and start a job running, with a simple meta refresh
checking if the work had been completed. You can drive all of this from a
simple database. This reduces any risk against your web server and could
be offloaded to another server if neccessary.

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
Thanks: I should have made it explicit that I WANT the file to open on the
server, not the client. The file itself has an embedded script that changes field contents upon opening, by connecting to a database via a DSN on the
server. Right after the .pdf has been opened and thus changed, I want to
direct the browser to it.
"Norman Yuan" <no****@nowhere.no> wrote in message
news:e1****************@TK2MSFTNGP12.phx.gbl...
So, if a user is thousands miles away from web server where you ASP.NET app
is hosted, yo still want to start Abode Reader on the server and ask the
user to COME OVER to look at it?

Sure, you can run some desktop app on the server, if the ASP.NET account

is
assigned proper permission, but it is generally a bad thing to do: what if a
thousand users want to do the same thing in about the same time (or in a
short time span), can the server afford to start a thousand Adobe Reader
instances without crashing?

What you want to do have client browser sent a request for a *.pdf file to the web server, your ASP.NET page then have the server streams back a

*.pdf
file to the user's browser. The bowser then starts Adobe Reader (inside

the
browser) on the client machine, if the browse is capable of doing that

(IE,
Netscape do).
"BCM" <BC*@none.com> wrote in message news:40********@news.unc.edu...
In a simple console app the following few lines open up an Acrobat file without a hitch:

Process p = new Process();
p.StartInfo.FileName = @"C:\test.pdf";
p.Start();

But the same code in an ASP.NET app does NOTHING. No error message, not anything at all. In fact, if I add the following line after

process.Start:
......
p.Start();
Response.Write(p.Responding.ToString());

SOMETIMES it returns True, but more often I DO get an error, which states that "Process has exited, so the requested information is not available."
Now I've given the ASPNET user read rights on the file, but I can't

think
of
anything else that might be precluding the file from opening. Any ideas? Thanks in advance!



Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joey Mack | last post by:
Greetings. I am trying to use the System.Diagnostics.Process class to perform some actions through the Windows command line. The applicable code appears below. The code builds the follow command...
5
by: Ty Moffett | last post by:
I'm using a queue to hold a series of strings that are complete command line arguments to start the silent/unattended installation of various pieces of software. Here is some sample code. 1 Dim...
1
by: solex | last post by:
Hello All, Hopefully someone has run into this error. I have written a class(source below) that launches a thread to monitor the StandardOutput of a System.Diagnostics.Process, in particular I...
2
by: andreas | last post by:
hi, In windows xp in the start launch menu when i put notepad "c:\test.txt" i get notepad with test.txt in it. in vb.net when i state system.diagnostics.process.start("notepad.exe" i get...
1
by: Michael Maes | last post by:
Hi, How would I copy the file 'test.txt' from C:\_A to C:\_B. I need this through the System.Diagnostics.Process-Class and NOT the IO.File-Class p = New System.Diagnostics.Process()...
7
by: Phil Mc | last post by:
Hi all I have a small scheduling application that I have written which will be running on a Windows 2003 server. This application is started at different times by an 'autosys' job (though I am...
11
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very...
2
by: Rupali | last post by:
Hi all, I am tring to call a .vbs file using System.Diagnostics.Process class with following code. Process objProcess = new Process(); objProcess.StartInfo.FileName = "C:\\testScript.vbs";...
0
by: Daniel | last post by:
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine....
5
by: Saya | last post by:
Hi Folks, I have now spend app. 3 days to get the below scenario to work, but can not get there! ..Net version = 2.0.50727 Windows version = Microsoft Windows = Windows Server 2003 Now I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.