Solved

Opening a file in the default windows application from ASP.NET

Posted on 2009-04-03
7
355 Views
Last Modified: 2012-05-06
We are using asp.net with c# for the code behind and this web app will be only be used on our intranet, so no outside access.  How can I open a picture from a supplied network path that will not popup a dialog box.  This picture will be opened in the default windows application (PhotoShop on most machines).  

I have tried using Response.AddHeader(Content-Disposition, inline; filename= + file.fullpath);.  The problem with this is it only opens it in the current web page.  

I have used Response.AddHeader(Content-Disposition, attachment; filename= + file.fullpath);.  This however, open a dialog box (not acceptable); also I have read that the application opening the file would not actually know the location of the file but just have a copy in memory.  

Is there an easy way to launch a file (jpg/tiff) in the default windows application assigned for that file type.
0
Comment
Question by:dlsimic
  • 3
  • 2
  • 2
7 Comments
 
LVL 27

Expert Comment

by:nmarun
ID: 24064348
0
 

Author Comment

by:dlsimic
ID: 24064569
We tried the suggestion in the first link and while running in debug mode on devlopment machine it works fine.  However, nothing happens when we release the code to the webserver.  We checked both the webserver and client machine and also viewed task manager.  Monday we will try making a windows service, dll or some other windows application that we will call from the web app to launch the program.  Let me know if you have any ideas where we won't need to create a seperate process on the client machine.
0
 
LVL 27

Expert Comment

by:nmarun
ID: 24064675
dlsimic: I'm running out of ideas myself. Let's see what the separate process does.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 14

Expert Comment

by:jjardine
ID: 24065857
The idea of the process class will not work in your situation as it sounds like you are trying to get the image to open in the default program on the client's machine, not on the web server.   It is tough to control the client computer to make the web browser open up documents in their default programs.   I may be totally off on what you are trying to do.  Can you clarify where you want the to be viewable, on the client or on the server?
0
 

Author Comment

by:dlsimic
ID: 24067109
When they click a button on the intranet website it must open a jpg/tiff on the client machine in their default windows application.
0
 
LVL 14

Expert Comment

by:jjardine
ID: 24071765
I think the only way you could do this is to have a special page that you direct them to and change the content type to the type you want to give them.  an example would be a word doc or excel.  This should then ask them to open or save the file.  I don't think you cna force it into a default application without a prompt for open or save.
0
 

Accepted Solution

by:
dlsimic earned 0 total points
ID: 24079393
In case someone else is looking how to do this; here is how we solved our problem.

function OpenImage(path) {
                var imagepath = path.innerText;
                imagepath.replace('\\', '/');
                var oShell = new ActiveXObject("WScript.Shell");
                oShell.run('"' + imagepath + '"', 1);
            }
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 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