RE: making permissions optional
- From: wawang@xxxxxxxxxxxxxxxxxxxx (Walter Wang [MSFT])
- Date: Tue, 21 Nov 2006 12:10:09 GMT
Hi Dave,
The Permission Calculator Tool calculates the minimum permission set
required to run an application by examining all applicable code paths of
all application assemblies and dependency assemblies:
#Permission Calculator Tool (Permcalc.exe)
http://msdn2.microsoft.com/en-us/library/ms165077(VS.80).aspx
Starting from the entry point of the application, the tool traces all code
paths through all application assemblies and the shared and system
libraries called from the application. The tool maintains a simulated call
stack that contains all the assemblies involved in the code path trace. On
every code path trace, the tool checks for the presence of declarative
demands, link demands, and declarative stack walk modifiers.
If you use Reflector to view J# Assembly.GetManifestResourceStream(), you
will find one of its called function has unsafe signature:
internal virtual unsafe Stream GetManifestResourceStream(string name, ref
StackCrawlMark stackMark, bool skipSecurityCheck)
The resulting permission set is calculated using the all code paths. That's
why you're seeing some permission sets that are never used in your code
directly.
If your Web application contains code that requires more permissions than
are granted by a particular ASP.NET trust level, the easiest option is
customizing a policy file to grant the additional code access security
permission to your Web application. You can either modify an existing
policy file and grant additional permissions or create a new one based on
an existing policy file.
Another approach that does not require an update to ASP.NET code access
security policy is wrapping your resource access code in its own wrapper
assembly and configuring machine-level code access security policy to grant
the specific assembly the appropriate permission. Then you can sandbox the
higher-privileged code using the CodeAccessPermission.Assert method so you
do not have to change the overall permission grant of the Web application.
The Assert method prevents the security demand issued by the resource
access code from propagating back up the call stack beyond the boundaries
of the wrapper assembly.
For more information about above two different approaches, please refer to
following article:
#Using Code Access Security with ASP.NET
http://msdn2.microsoft.com/en-us/library/aa302425.aspx
Sincerely,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- References:
- making permissions optional
- From: David Thielen
- making permissions optional
- Prev by Date: Re: Why is this method requesting these permissions?
- Next by Date: Re: how to use <authorization>
- Previous by thread: making permissions optional
- Next by thread: Re: Why is this method requesting these permissions?
- Index(es):
Relevant Pages
|