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
841 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

626 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