0
Answer

C# Security/Permission issue with web hosted UserControl

Ofer Lahav

Ofer Lahav

16y
4.5k
1


I wrote a user control that uses another DLL. The other DLL implements IRC protocol over TCP/IP.

I created .snk file (using sn.exe), and introduced it to the assembly attributes of both DLL's. I'm now trying to run the DLL, while hosted in a web page.

When I give set permission of Machine -> Code Groups -> All_Code to FullTrust - the DLL is run correctly.

However, granting FullTrust to All_Code is not safe, therefore I'm trying to grant FullTrust to the specific DLL. To do so, I create a child under Machine -> CodeGroups -> AllCode, in Membership Condition I select "Strong Name" and import the DLL of the user control. A public key is then shown. Finally I set the permission set to FullTrust. The application, however, fails to run and comes up with an error:
System.Net.DnsPermission, System, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089

Also note that I added AllowPartiallyTrusted assembly attribute for the DLL.

Two questions actually...

a) How do I set up the permission and/or what code/build changes are required to allow the DLL's to run without compromising on FullTrust for All_Code

b) Taking it one step further, when we deploy the DLL to customers who are nto computer expert, how can we setup the client PC with those permissions? Is there a need for an .msi file that will do the setup? Having an .msi is less desireable for us, cause the all purpose of running an application from the web is not having the client download and install a software. So we're looking for the easiest solution for the customer.

But first, of course, we have to sort out the permission issue when doing the process manually. Any help with this will be highly appreciated.

Thanks,
Ofer/ClickFM