Process.Start problem

G

Guest

Hi,

It should be something very simple, but I do not know what I do wrong.

I display some PDF filenames form a folder into a gridview and when the user
clicks on the name, it execute this code.

System.Diagnostics.Process.Start(filename)

‘filename’ is the full path of the file (like ‘C:\Folder\file.pdf’)

When I run this from VS ( on http://localhost: …) it runs ok and open the
file in a new windows.

When I pulish the site and run it from the server the PDF doesn’t open, and
no error message appear (not even a javascript error).

I do not know why... please help. ;)
 
E

Eliyahu Goldin

Most likely you are having a security problem. Make sure the account your
applications runs under has enough rights to start applications.

Eliyahu
 
G

Guest

Witch one is the account my application runs under?
I have made ‘IUSR_SERVER’ (witch I believe is the account) the member of
Administrators Group, but it still doesn’t work.

Is it right what I have done?
 
D

Damien

Cosmin said:
Hi,

It should be something very simple, but I do not know what I do wrong.

I display some PDF filenames form a folder into a gridview and when the user
clicks on the name, it execute this code.

System.Diagnostics.Process.Start(filename)

'filename' is the full path of the file (like 'C:\Folder\file.pdf')

When I run this from VS ( on http://localhost: ...) it runs ok and open the
file in a new windows.

When I pulish the site and run it from the server the PDF doesn't open, and
no error message appear (not even a javascript error).

I do not know why... please help. ;)

Hi Cosmin,

What are you actually trying to achieve? Process.Start is trying to run
the file on the server, not on the machine with the browser window. Is
this really what you're trying to achieve? Usually the best options
when wanting to run things on the server in response to website stuff
are 1) Having a service that can run programs independantly, or 2)
Having a program that runs when a user logs in. In both cases, the
website communicates with this other program using remoting or other
techniques (2 is preferred if interaction with the desktop e.g. a
window) may be required)

If, on the other hand (as I suspect), you're wanting the PDF to open at
the browser end, you're better of either directly linking to the pdf
file, or if (for security checking reasons, or if the files reside
somewhere that you cannot map a virtual directory to, etc), then you'll
probably want to change the Response.ContentType property to the
appropriate type for PDF and then stream the PDF down to the browser
using the Response.OutputStream

Damien
 
G

Guest

Hi Damien,

Yes, I want to open a PDF file witch is located on the server, to the
browser end, but can you be a little more explicit or can you give me an
example please.

Thank you.
 
D

Damien

Cosmin said:
Hi Damien,

Yes, I want to open a PDF file witch is located on the server, to the
browser end, but can you be a little more explicit or can you give me an
example please.

Thank you.

Hi Cosmin,

The original problem code in this post:
http://groups.google.com/group/micr...line+pdf+"new+window"&rnum=2#f78a530b7ec2b6f2

may give you an idea of how to do the sending part (although in that
case the content is already loaded, and uses WriteFile() rathen than
OutputStream), it may give you enough to work from?

Damien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top