Saturday, March 24, 2012

Permission Failures with an embedded windows form. What’s the proper way to do this?

I have a windows web form control that opens up a serial port. When I try to embed it an HTML file, I get a securityException when it opens the port. --System.Security.SecurityException: Request for permission of type System.Security.Permissions.SecurityPermission, mscorlib,.......

1) Is there any way I can just tell the browser to trust this object, or just completely trust anything and everything from a certain web site?

2) Right now I had the DLL download from the server when the page loads. It is quite small so speed isn't an issue, I like the concept of downloading it everytime it is used because it will be easier to keep updated. But in terms of permission I was wondering if the proper way may be to install it as a plug in or addon?

The syntax I currently use is :

<object id="SIOControl1"classid="http:SIOControl.dll#SIOControl.SIOTestControl" height="500" width="500" VIEWASTEXT>

You cant programatically "tell" the browser to just trust it, nor can you tell the browser to trust everything from a specific site, not from your application. Imagine the huge security hole that would be. What you CAN do is as the "user" of said site:

Through Internet Options > Sites > Trusted Sites:

Add the address of your website to the trusted sites section. Then set the security of that "zone" to match what you need to accomplish what you're after.


I don't think the solution is as simple as adding it to a trusted site. Just for testing purposes I did that, and set all IE secuirty options and it still dosn't work.

I've tried to add FullTrust to the site with caspol, but to tell you the truth, I just can seem to figure out the proper command.

I've tried: caspol -addgroup LocalIntranet -urlhttp://localhost/SIOControl/* FullTrust

but it tells me that I have an Invalid Label or name, but when I do a caspol -lg I see LocalIntranet there?

0 comments:

Post a Comment