Solved

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

Posted on 2009-04-03
7
348 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
File Upload Control on a ASP.NET Overlay Page 1 42
Why don't I see this table in EDMX file? 2 23
ASP.NET reading ATOM 2 51
Error in query expression 3 35
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 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

21 Experts available now in Live!

Get 1:1 Help Now