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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

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.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to count occurrences of each item in an array.
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)

763 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