Solved

How do I launch an external program like Notepad or just opens a .DOC in MS Word from my C# / ASP.Net web application?

Posted on 2010-09-21
4
836 Views
Last Modified: 2012-08-14
Hi Everyone,

I have created an ASP.Net web application (code behind = C#) and now wants to launch an external program or just open a .TXT or .PDF file from a button on one of my forms. I coded everything already and the button calls a C# method and I use 'Process.Start(@m_questionAndAnswerContext.QuestionInfoURL);' inside this
method and pass a URL or just a file path and name to this method and it opens on my machine during development just as I need it to do.

The .PDF, .TXT, .XLS etc., etc. files will be on a remote server and not on the client's machine but I want to open the file chosen by the client using the external application like Notepad or Adobe that is installed on all my client's machines.

The problem comes in when deploying this application to the production web server. When we now click on the button/link, it does not open the file/external application on our machines anymore but tries to open it on the production web server. So how do i go about getting the file/external program like Notepad or Adobe to open the file passed to it on my client's machine when running in production?
0
Comment
Question by:eddiecon
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
haringsrob earned 500 total points
ID: 33723332
0
 

Author Comment

by:eddiecon
ID: 33723477
Thank you for your prompt reply harinqrob. Let me quickly read that article and try it out. Will get back to you to let you know if it solved my problem.
0
 
LVL 1

Expert Comment

by:haringsrob
ID: 33723501
also if its a local file. you could try using:

Response.Redirect "c:/test.doc"

this wil redirect the browser to the file.
If you want a link to open the file you could try:

<a href="c:/test.doc">test.doc</a>
0
 

Author Closing Comment

by:eddiecon
ID: 33723737
Although this did not help, I really appreciated the offer to help. I figured out that this is not the way to go. Process.Start will only try to start the process/application on the web server on which the web application resides. I will have to follow the technique where you download the file to the client's machine and then open it in the browser. At least I think that it is the way to go.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now