Partially trusted web apps

Z

Zsolt Soczo

Hello,
I would like to set up a public web hosting environment.
I want to run the foreign apps under Medium trust. However the main web app
must run under Full trust. I don't want users change the trust setting in
their web.config, so I locked it in the machine.config.
How can I give full trust to one of my webapp only?

Regards,
Zsolt Soczo
 
D

Dominick Baier [DevelopMentor]

Hello Zsolt,

if allowOverride=false in machine.config - you can't.

Another approach would be to create 2 web sites in IIS - and place a web.config
in the corresponding root directory which set the trust level for the site.
 
Z

Zsolt Soczo

Sorry, I mean web_mediumtrust.config.


Zsolt Soczo said:
Thank you for your response.
I think I could do it by creating a custom policy derived from the
web_minimaltrust.config.
In this policy I could give Full trust for my assemblies based on
StrongNameMembershipCondition and UrlMembershipCondition. I successfully
set up such an environment using 2 new codegroups, my main pages got full
trust (it is needed for it because it uses remoting).

However, when I want to run the start page of a web service under a
_restricted app_ I got an exception:

SecurityException: Request for the permission of type
System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
failed.]

System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter
xmlImporter, SoapReflectionImporter soapImporter, Boolean
serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use,
SoapParameterStyle paramStyle, String elementName, String
elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members,
Boolean validate, String key) +0

System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo
methodInfo, Boolean client, XmlReflectionImporter xmlImporter,
SoapReflectionImporter soapImporter, String defaultNs) +1996

This is strange because 2 codegroup explicitly gives Full trust to ms
assemblies. I lost, please help. I attached the modified config file, the
last two codegroup is my addition.

Regards,
Zsolt Soczo


Dominick Baier said:
Hello Zsolt,

if allowOverride=false in machine.config - you can't.

Another approach would be to create 2 web sites in IIS - and place a
web.config
in the corresponding root directory which set the trust level for the
site.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,142
Messages
2,570,820
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top