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.
Related
I would like to know if there is a technique or solution for the follow problem.
I have a software application that is currently running inside of a Microsoft RDP session. I have some help resources built into it in which some of them open up on a webbrowser. Some of them are YouTube videos. The problem is taht through organisational policies, they cannot open YouTube clips within the RDP which connects to a interstate server.
What I would like to do is instead open up a webpage outside of that RDP connection on the local host computer instead, which does not have any restrictions like opening up YouTube webpage to play video clips.
Can you please suggest a technique, utility or solution to this problem?
Thanks,
Colin.
The nicest way to do this would probably be to create a dynamic virtual channel plugin for RDP: https://msdn.microsoft.com/en-us/library/bb540859(v=vs.85).aspx
You would have a server-side component registered to handle the protocols (http/https, I assume) you want to redirect back to the client, possibly with some filtering logic if you still want a few to run server-side (such as intranet sites); then a client-side mstsc plugin whose only job is to call ShellExecute on the URLs you pass back.
Piggybacking on clipboard redirection might be less code, but it obviously has side-effects - e.g it obliterates anything else the user might have had on the clipboard.
I want to run an exe on client system from my c# asp.net website. When I use Process.Start()
it throws an error:
The requested operation requires elevation.
How do I set permissions to run that exe?
You can't spawn processes on the client machine from server-side code.
When you use Process.Start in server-side code, it is attempting to execute the process there, on the server where the website is hosted. If you wanted to create processes on the clients computer then you would need to expose a download for them (and not in employing subterfuge, like malign sites might do to install software - supply it gracefully, and normally (and with permission)), or a Silverlight application or something along those lines.
The bottom line is that the code you want to execute (even if that is just to spawn a process) must reside on the client, and be executed there.
You can't run an application from a web server like that. You will have to have the user download the application by supplying the EXE, a setup file or using ClickOnce.
Or you can develop an ActiveX control that you can have the browser automatically download from a Trusted Internet Zone.
Once downloaded, proper signing with a certificate (signed from the trusted (corporate) root certificate) will avoid the user getting a prompt to ask whether he wishes to allow the ActiveX control to install/be activated -
The ActiveX control can subsequently do anything the interactively logged on user could. This means that to actually install a program you'd need to elevate (UAC on Vista+); But if the goal was just to run a standalone executable, you should be good to go.
This all assumes white-hat purposes in a (larger) corporate setting, because it relies on PKI infrastructure and central browser policies, to name just two.**
This would, really, lead to some excellent questions on serverfault or superuser
I noticed you said you wanted to run an exe file on the client, but you didn't say explicitly that the exe is on the server and you want to push it to the client. Everyone seems to be assuming that is the case.
You CAN accomplish this fairly easily with a small JavaScript if you have a few prerequisites:
The executable is already present on the client machine.
All of your clients are running IE
You can enforce a policy to put your site in the Intranet or Trusted
Sites zone.
So basically this means it's a corporate intranet application. I am assuming this is probably the case since, well, if you were expecting to do this with a public app, I would be surprised.
For the script to accomplish this, please see my answer to this question:
How can I get a program on a client machine to run from an ASP.NET page?
Overview
C# File - Users PC
PHP Server - Hosts Webpages for application
Server and Users PC on local network
I have a c# file that reads weight from a USB scale. How would I trigger this file to run so it feeds into my program. The problem is I am using PHP to host our webpage/application so its not running client side and the scale is not hooked up to the server but to the clients PC.
The C# script would have to be on the clients in order to read the scale so how would I trigger this to happen?
Is this even possible and if not what would be a better way?
Important Edit
I was able to run the Scale Script (C#) when I wanted by having PHP and C# use TCP sockets.
The C# would listen for PHP to send something and when it did it would read the scale and send this information back to PHP becuase PHP was listening for a response. Mixed in with a little Ajax and it updates in the web browser.
Gave Chris Credit because he was the most helpful with answering my questions
It sounds like what you really want is for the client application to submit the data to the website itself, and the most suitable approach is probably to expose a web service from your server.
This service should accept weight data, along with some sort of customer key or whatever, to correlate the records correctly on the server side. I've never created a web service in PHP personally, so I can't give any advice on the implementation of that, but it is fairly trivial to hook a C# client app up to a web service once you've exposed its metadata (assuming you use SOAP).
you can't start C# application from a web page in a way that'll work in every browser every time. BUT, you can have some workarounds:
Use ActiveX component that read the data in the client and upload it to the server. the biggest cons is that it'll only work in Internet Explorer
use Silverlight client application that runs on elevated mode (v4) and upload the data to your server.
refer your clients to download application (the C# application you wrote about) and run it - this application will upload the data to your server.
hope this helps.
C# isn't a scripting language, it's a language that compiles into executable binaries or libraries. You won't be able to execute C# code on the client's computer via a website because C# code needs to be compiled before it can run.
Presumably what you really want is for your compiled C# binary to be executed on the client's machine via your website. You won't be able to easily do that. There are a lot of security measures in place to prevent browsers from running programs on your computer. There may be ways to hack around these security measures by using plugins (such as ActiveX), but it's not something that will be a one-liner.
Edit: I think you need to step back and think about what you're trying to do in a broad sense. You're trying to create a website that can read information from a user's USB port. This is the type of thing that browsers are designed to prevent, and for good reason. I wouldn't want random websites to be able to access peripheral hardware without my explicit permission. If you want this website to function the way you're expecting, you're going to have to seriously think about the security implications. You'll need some kind of client-side code (ActiveX, Silverlight, ...), and the user will need to explicitly give permission to for this all to happen. It won't be easy, and it won't be automatic. And I'm damn glad that's true.
I wonder what the best way to test and debug facebook iframe applications locally (using the facebook c# toolkit and the azure toolkit)?
When i try to debug it's always starting the Compute Emulator on a different port.
Basically i want to have a special facebook iframe app pointing to a specific port on localhost (e.g. http://localhost:81) and after pushing the debug button that my app url (e.g. http://apps.facebook.com/myspecificappdev) is being started in my browser (with debug functionality).
I found this thread but unfortunatly this didn't help me a lot: http://azuretoolkit.codeplex.com/discussions/207487
What's the best way to debug such applications? Is their maybe a sample project which already has that part set up correctly?
Ok, here is what we do (at Thuzi). We set up an dedicated IIS web site for our code. We create a bogus domain like fbapp.mycompanysdomain.com and then we edit your machine's (or other machine's) Hosts file to point to the proper IP address. When we set up the site in IIS we use a host header which means that we don't need to worry about port numbers. When we debug we simply attach to the process.
So you point your web browser to the FB URL and it should always land on your web server (whether you are debugging locally or not). I know this sounds like a little more work, but it ends up being so much easier in the long run and better reflects what will ultimately happen. I realize if you are using any kind of storage then you will need to start that up, but it's still a lot easier this way..
If your app is simply a website, then you don't need to run the compute emulator to run it. I would setup the site so that it runs on IIS on a specific port, then debug the website project, not the cloud project.
There is a bit more to it than just that however. If you're using development storage then you'll need to start that yourself as it won't automatically be started when you debug the website. If you have a RoleEntryPoint class then you need to be aware that none of that code will be called. Also if you make use of anything in RoleEnvironment (like settings) you'll need to put a wrapper around those items so that they'll still work when not running under the emulation environment (RoleEnvironment.IsAvailable is very useful for detecting this). A setup like this is very useful during development because when you make small changes to CSS of JavaScript you don't need to restart the compute emulator to see your changes.
You're on the right track. You need to create a new facebook app and point the iframe / canvas / tab url to localhost with the specific port cassini chose for the project.
What I did to ensure the the windows azure app stays on the same port:
I placed this as a pre-build event:
"C:\Program Files\Windows Azure SDK\v1.4\bin\csrun.exe" /devfabric:shutdown
This makes it better but it's still switching port sometimes
To summarize, as we all know,
a) Silverlight is expected to be hosted by a browser, and runs in an isolated sandbox so that there won’t be any security issues
Silverlight don’t have direct access
to the file system, other than the
isolated storage area
There is no
direct way to open common dialog
boxes like File Save in Silverlight (Though Opendialog box is supported).
b) Silverlight can’t access local resources like a printer
What are the ways to go beyond the sandbox, so that I can host a Silverlight application locally, to read files and save them back if required, to hand over data to a printer, and so on..
Update:
Is full WPF is not an option for me? No. I'm also interested in a cross platform solution - for instance, you could host Silverlight in Mono Web browser control, so that you can run it virtually anywhere.
The idea is to re-use the same application that I'm building for web in my desktop as well, by providing separation of concerns at some areas - like persistence, resource access etc.
Scenarios:
1- Some kind of gadget container, with access to local resources.
2 - A desktop Silver light based media application
Update:
I just did a POC to enable me to access printer and save files locally, of course through a shell where I'm hosting my Silverlight application. If you wan't you can have a look at the post here in my blog
Two ways I can think about is,
Create a "Shell"
Host the HTML Page with Silverlight, in a Winforms desktop application, using a web browser control, and communicate to and fro using HTML DOM. Then I can request the hosted shell to do things like printing. See details here
Mono also has a web browser control - based on FireFox XULRunner instead of IE - not yet succeeded in loading Silverlight inside that. Another option might be using Webkit.
Embed a web server
Embed a light weight web server with in the Host application, and handle requests to perform such operations. You can probably define a protocol on top of HTTP for things like saving to a local folder, sending data to print etc.
Is a full WPF application not an option for your situation?
As you probably know Silverlight uses a subset of WPF so you may be able to change your application relatively easy.
A wpf app would be easier than having a web server etc bundled within your application.
You wont in the foreseeable future be able to have access to resources such as printer and files (apart from isolated storage) through Silverlight as you know.
You could have a seperate part of your app to upload files to the webserver then read these in your silverlight app from a service.
Depending on your printing requirements (e.g. if you just want to send everything to an office printer) you could send the informaton you wanted printed to a service that will then print it for you. However I am guessing you want each client machine to be able to print in which case this wont work for you.
I am attempting to also reuse a codebase for both desktop and silverlight. There are two options that I know of in addition to the ones mentioned
If you directly reference (instead of a project reference) a silverlight dll from a normal project, it should work. This would let you reference a silverlight dll for both projects.
Have two project files (one wpf, one silverlight) that point to the same set of files. You might have to have to use a few compiler flags here and there, but this should let you use the same files for both.