Open .doc located in webDAV server directly into Word - c#

You see I am trying to edit a file that’s in the WebDAV server, but I am doing this through ASP.NET and C# in a DotNetNuke Website. I saw the code for the Sample Server Browser
included with the ITHIT WebDAV SDK, where I saw a functionality similar to the one I require , but its a local Windows Application and it uses Process.Run() to open Word. This process will not work for my case however since that would
cause the process to be executed on the server (w3wp.exe process) and not the clients machine. My
questions is how would I implement this capability, you can take a look at their Ajax Browser for an example; right click any document and "Edit Document" appears, which causes Word to open up. How can I open a specific word document from the WebDAV
server directly into word? Am I going to have to use JavaScript? If So, how can
I pass the location of the file as a parameter?

To open a Microsoft Office documents from your web page, you will need to use JavaScript. You will need to program FFWinPlugin in case of Chrome, FireFox and Safari, or SharePoint.OpenDocuments ActiveX in case of Internet Explorer. Note that your server must be a Class 2 WebDAV server.
You can find more information here.

To open document on client side you need javascript e.g.:
<script type="text/javascript">
window.open('http://www.usability.gov/templates/docs/u-test_plan_template.doc')
</script>
This is probably the way used by Ajax Browser the problem is that then file is downloaded to local computer and when you update it, it is necessary to upload it back again.

Related

How can I open a file on the user's machine from the backend in C#.Net WebPages?

In my web-app (WebPages, C#.NET) I have a drag and drop file box where user's can drag files from windows explorer and, once dropped, it will save in a given location on a shared drive. This part is working fine. The box looks something like this:
The problem is, that it also reads files from the same directory and my user's would like to be able to open the files from this interface on dblclick. I have written an ajax request with jquery (the ajax, too, is working fine), but I can't seem to get the files to open on the user's machine no matter what I try.
Most references I try and look up point me towards System.Diagnostics.Process.Start(#"<directory goes here>") but this doesn't really do anything. It will open some process on the server side, but nothing opens, either on the server or on the user's machine.
What they'd like to do, for instance, is double click 'Hazcom.xls' and it would use the default associated application to open the file. In this case, of course, Microsoft Excel.
Is this even possible or am I chasing a wild goose here?
Sources I've Tried:
Open file with associated application
http://www.csharp-examples.net/open-file-with-default-application/
How can I open Windows Explorer to a certain directory from within a WPF app?
c# open file with default application and parameters
There have been a few more sources I've tried, as well, but they're all pretty much in the same vein as these.
Additional Info:
The internal Intranet application runs on a server using IIS 8
The solution is desired to be opened on the user's machine and not, say, the server itself.
The path to the files is dynamically changing depending on what they have loaded into the interface.
Though, I'm not expecting this to be a solution viable for client side (jquery) I'd be happy to look into that if that's the only solution available.
I'd also settle for simply opening the file location, instead of the actual file itself, but I've had no luck with this either, for what looks like the same reasons as the original problem.

Creating a stub for editing office documents

I'm looking to create a synchronization mechanism for a document storage service.
The essential idea is that the user downloads a stub file say somefile.stub that contains a link to the file on the server.
When the stub file is clicked on an app on the users machine (associated with .stub) opens up looks in the file and downloads the document from the server in the background.
Once I've got the file locally I'd like to get windows to open up the file in the appropriate editor e.g. word. I really don't want to have to save out the file and then open word or whatever via Process and a command line.
Also, I'd like to be able to grab the document when its saved and send it back to the server to keep everything in synch.
I'd prefer to write the client application in c# if possible.
You have to create a service running continuosly on the client machine, that should orchestrate the stub file transfer and the opening of them. Opening with the proper program can be achieved by using Process with StartInfo.UseShellExecute = true;. You can also use a FileSystemWhatcher to be notified when the external app modify the file.
Here is one solution:
Create a Class 2 WebDAV Server and publish your MS Office documents via it.
In case you target MS Office 2013 you can use the following link to open documents for editing directly from your WebDAV server:
ms-word:ofe|u|http://mywebdavserver.com/path/document.docx
This will eliminate download/upload steps and will work in the SharePoint-like manner. You also do not need to deploy any client application in this case.

How to have browser open a file from a custom protocol?

I currently have a url that looks like this: protocol://folder/file.js
I can open this same file from my local disk using a url like file://C:\folder\file.js
When the application is run inside its own provided environment, this protocol is available and it loads the file just fine from my local disk.
I'd like to also be able to access these files for times when I run this application inside a regular browser like firefox or chrome.
I've managed to register this protocol on my windows machine and forward the url to a custom c# program that can then open the proper file in browser again. However, it opens the file in a new tab and doesn't seem to work properly when attempting to open the file from a tag on the page.
Is there an easy way to get firefox (or any other browser) to open a file from a custom protocol directly in the tab that requested it?
To do this in FireFox, you must implement a XPCOM object. There are instructions on how to do this in C++. For C#, you follow the same instructions, but use GeckoFX to get wrappers for .NET.

how can i open a excel inside a web browser?

I need to open a excel in web browser when click a button.how to do that in asp.net
You can't control and launch software on the client (browser) computer - why? Security.
If this was possible, hackers would have taken over all computers long ago...
Can you please explain exactly what you are trying to do? Instead of asking how to open excel from the browser, if you explain what you need to accomplish, perhaps we can come up with a better idea.
I use Google Docs Viewer for opening a wide variety of files in the browser.
Example:
http://docs.google.com/viewer?url=http%3A%2F%2Fyoursite.com%2Fyourexcelsheet.xlsx
you just need to give the url of the excel in the server
Excel
Only you can open a excel in server you can do.not in Client
You can open and control and excel file on the server side with .net, then you can write an html/javascript frontend (or silverlight) for the actions. But you cannot open the ms excel itself as a dom object etc.
Look into the excel object model for .net.

How to start up your .NET program from web browser?

Could you provide example of JavaScript function for starting up application installed on your computer from a web browser (eg google chrome 4). It particular if .Net APPs have any special simplifying this process apis of out there are some libs for such staff, please share link with us.
so how to create and store in run on start up programs a small local server which would handel some local urls like http://localhost/maAppServer/MyAppCalculator/Start for starting apps that have written in its config file their names and local urls on install?
So how to start up your C# .NET app\program from web browser?
I don't believe its possible in Chrome, starting an EXE on a users computer could be considered a security violation. Some ActiveX, and file:// links in internet explorer may work. Also, OneClick deployment may do something similar to what you are after (not exactly though I don't think, and I believe they require an add-in which may not be available for Crhome) http://www.15seconds.com/issue/041229.htm
I'm not sure what you're asking for. You can start an application on your computer just by linking to it in the HTML page. However, if you need to pass data to it, then it's a different matter altogether, although it's still simple.
An example is what www.nexon.com does with it's MMORPG, MapleStory. You log on to the website, and the web page starts the game after the authentication. Another example would be the magnet links on file-sharing sites.
You need to create a protocol handler, it can be in any language like C++/C# and register it on the client's computer. Like so - http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx
Then, just use the protocol you built to pass on whatever data necessary. You can add a link that can be clicked, a button, Response.Redirect() from the server, whatever you like.

Categories

Resources