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
840 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The viewer will learn how to count occurrences of each item in an array.

739 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