开发者

Launch local application with Silverlight

开发者 https://www.devze.com 2022-12-16 15:18 出处:网络
I would like to know if there is any way to launch a local application with silverlight. I\'m having some security problems doing this 开发者_如何转开发with a user control embedded in IE 8, so I would

I would like to know if there is any way to launch a local application with silverlight. I'm having some security problems doing this 开发者_如何转开发with a user control embedded in IE 8, so I would like to convert this into silverlight app. This little issue is stopping me to go forward with silverlight, so if any suggestion, I would appreciate to hear it.

Thanks in advance..

Carlos.


This will be, theoretically possible, using COM interop with Silverlight OOB in SL4, but you will still have the same security issues, and in addition, add some deployment issues.

In order to do this directly from within IE, you'll need to make an add-in that gets installed with proper security permissions. Any "automatic" model for this would violate the standard IE security policies, so there is no direct means of getting from browser->local system.


this would totally invalidate Silverlight security model. So, good luck with that. Pretty sure you can not do it. This is what officially is known as a "Bad Thing."

Things I learned from Jurassic Park: Just because you CAN do something doesn't mean you SHOULD do something.


It is absolutely possible to get "Out of Browser" support using Silverlight 4. But what you need to do in order to access applications on the "Host" machine is the certify the SL4 application as being trusted.

This will involve getting a certificate for it. This could be obtained from CA (or similar for Internet applications) OR you could generate your own certificate for Intranet use and have the users simply install it or have it installed via another automated sys admin style process.

The bottom line is that when the SL4 application is running OOB AND it is trusted, it can access anything on the host machine; to a point.

Even though you can have file access and so forth, you still cannot call the application directly. That is unless it's installed as a COM object.

So what you will need to do is invoke the application using the "script" host COM object. You create a reference to the Script host and then simply pass in the command (and parameters if you like) that would invoke the application.

Hey presto, you broke the wall :-)

It should be noted that the use will still only be able to run the applications on their machine that they are currently allowed to. So you won't be able to invoke Admin tools on a user with limited control.

See here for details http://msdn.microsoft.com/en-us/library/dd550721(VS.95).aspx


It seems to me that you ought to post a question about the developement of the user control you already have. Ultimately no matter what technology you use you will need to get the user to opt-in manually. Silverlight when hosted by a browser is designed to live in nice and secure sandbox that it can't get out of. It isn't the answer to your problem in this case.


Your Silverlight application should be a trusted application because it runs on a browser.

If you want to launch an application in your local machine use the below code:

AutomationFactory.CreateObject("WScript.Shell").Run(FilePath);

Use the namespace System.Runtime.InteropServices.Automation

0

精彩评论

暂无评论...
验证码 换一张
取 消