XBAP - Can I grant full trust only for specific methods?

187 views Asked by At

I'm considering using XBAP for an intranet application and I'd like to avoid setting the entire application to Full Trust.

Essentially, I have a few method calls that I'll need to make that will require Full Trust (e.g. DriveInfo.GetDrives), but I want to run the rest of the app in partial trust because it doesn't need full trust for 99% of the app.

Is there a way to have full trust on specific method calls and/or to break out the pieces that need full trust permission into a different assembly so I can keep the bulk of the app at partial trust?

Thanks!

1

There are 1 answers

1
NestorArturo On BEST ANSWER

Short answer: you can, .Net lets you decorate a method for an specific right level. But (and this is a big but), EACH USER have to give you that right no matter you requested the right. Maybe a click-once deployment help you more. In a click-once deployment your application inherits your user's rights.