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
835 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
Comment Utility
0
 

Author Comment

by:eddiecon
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
This article will show, step by step, how to integrate R code into a R Sweave document
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

771 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

11 Experts available now in Live!

Get 1:1 Help Now