Re: Process.Start problem

Tech-Archive recommends: Fix windows errors by optimizing your registry



Cosmin Spirescu wrote:
> 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

.



Relevant Pages

  • Re: Setting up a web page to print
    ... their server to figure out who you were and which sit to redirect me to. ... I did copy the Adobe Button ... > link to open Adobe Reader and display the .pdf file that I wanted to make ... But when I clicked on the "Application" hyperlink, the browser ...
    (microsoft.public.frontpage.programming)
  • Re: Setting up a web page to print
    ... I did copy the Adobe Button ... link to open Adobe Reader and display the .pdf file that I wanted to make ... I checked everything out in my offline browser window and everything worked ... find out why I cannot access the application.pdf file on the server. ...
    (microsoft.public.frontpage.programming)
  • Re: How to print .PDF files in the background using C#
    ... It's going to be hard to print document from server to clients printer. ... How about merging all 300 pdfs into 1 big PDF file? ... in browser and have user to click "Print" button only once. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: IIS wont serve PDF
    ... being able to save the PDF from the webserver is equivalent ... to viewing the PDF (as far as the web server is concerned -- it does the ... Maybe this web server is in a different internet "Zone" than ... > click & view -- in both cases, the browser retrieves the resource from the ...
    (microsoft.public.inetserver.iis)
  • Re: Process.Start problem
    ... Cosmin Spirescu wrote: ... >> If, on the other hand, you're wanting the PDF to open at ... >> the browser end, you're better of either directly linking to the pdf ...
    (microsoft.public.dotnet.framework.aspnet)