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.
Related
I am trying to make a custom protocol to open my c# windows application through a web application following the first comment's steps here: How do I register a custom URL protocol in Windows?
After setting everything up, I got to the last part where I have to type the link. Internet Explorer knows that I have to open some sort of a file but it requires a different reader.
Here is the protocol I made.
And this is the path, I have copied it, so it should be correct!
This is the folder of the program that I want to open.
Here is what happens when I go to that website. As you can see, I need to allow the browser to open the app.
And here is the problem. Any solutions to that? Of course, I can open normally the .exe file without getting any errors.
I am trying to run a macro-file that will be present in users desktop via my .net website, hence I would like to know how I can get the path of that macro file in my code and open it.
I am currently using following described code to get the path, and I think that this must be trying to take the path from server computer but I would like to get this from users computer, this particular macro file will open internet explorer and navigate to certain website and download a report to local computer hence I would like this to be run from users side.
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Is it possible to get the path automatically or should i get that from user.
please provide suggestion.
You are hosting a website, which is using a web server like IIS and the user access the site using a browser like edge, chrome, now the file is in user desktop, so the main question remains,
Does the browser process have the access to the file system of the user
Mostly no, especially not via the call Environment.GetFolderPath(Environment.SpecialFolder.Desktop);, this will be good for running it on hosted sever, where w3p.exe process is accessing the file system with required permissions
For the end user desktop
You need to provide the file dialog box, let user select the file / directory and need to plan to serialize the file to the sever (upload) for doing any processing. You can binary serialize the file using a provider like protobuf, msgpack to achieve the necessary functionality
Code you have provided, is good for for the process where you have direct control, like Console, WPF, which runs on the system under certain permission and thus access the file system for processing
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.
So I've got a flex project that runs on the desktop. I've also got server side C# code that I run to export some data into a PDF when ever I click a button on the flex application. Currently I just auto save the files to the temp folder inside of the C:\ directory, but I was wondering how I would go about opening up a Save File dialog box in Flex so I can select a location and name for my file and then pass the full file path string over to the server to do the exporting. My research brought me to a "Filereference" class in Flex, however it looks like that actually saves some sort of file, where all I want to do is get the chosen file path from it.
EDIT: I'm working with a project that has both an Adobe AIR Application side and a Web Application side, both being run by common code, so it'd be best to have a method that is supported by both.
Since you said you're building a Desktop application, I assume you are using Adobe AIR. You can use the File.browseForDirectory() method.
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.