<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Asserting for Permissions in .NET 4 – #18</title>
	<atom:link href="http://davedewinter.com/2009/06/25/asserting-for-permissions-in-net-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://davedewinter.com/2009/06/25/asserting-for-permissions-in-net-4/</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 22 Sep 2011 22:12:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: David DeWinter</title>
		<link>http://davedewinter.com/2009/06/25/asserting-for-permissions-in-net-4/#comment-190</link>
		<dc:creator>David DeWinter</dc:creator>
		<pubDate>Sun, 22 Aug 2010 23:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.rev-net.com/ddewinter/2009/06/25/asserting-for-permissions-in-net-4/#comment-190</guid>
		<description>Hi Colin, I know the security model is complicated. Unfortunately splitting the model into slices and examining each slice can sometimes lose how everything works together to create the big picture.

As far as I can tell, everything you&#039;ve described should make this work. Is the assembly that contains the Helper class signed with a strong name key? You can also check if your assembly is being registered correctly in the fully trusted assemblies list by checking AppDomain.CurrentDomain.SetupInformation.ApplicationTrust.FullTrustAssemblies for the strong name of the Helper assembly. Hope that helps--I&#039;ll try to be a little more punctual with a reply if you respond.</description>
		<content:encoded><![CDATA[<p>Hi Colin, I know the security model is complicated. Unfortunately splitting the model into slices and examining each slice can sometimes lose how everything works together to create the big picture.</p>
<p>As far as I can tell, everything you&#8217;ve described should make this work. Is the assembly that contains the Helper class signed with a strong name key? You can also check if your assembly is being registered correctly in the fully trusted assemblies list by checking AppDomain.CurrentDomain.SetupInformation.ApplicationTrust.FullTrustAssemblies for the strong name of the Helper assembly. Hope that helps&#8211;I&#8217;ll try to be a little more punctual with a reply if you respond.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Bowern</title>
		<link>http://davedewinter.com/2009/06/25/asserting-for-permissions-in-net-4/#comment-189</link>
		<dc:creator>Colin Bowern</dc:creator>
		<pubDate>Fri, 23 Jul 2010 07:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.rev-net.com/ddewinter/2009/06/25/asserting-for-permissions-in-net-4/#comment-189</guid>
		<description>This isn&#039;t making a lot of sense for those of us who don&#039;t frequently touch CAS.  I&#039;m trying the above in ASP.NET v4 and it&#039;s throwing an InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods.  I get that ASP.NET v4 under medium trust runs in a security transparent manner.  I thought by adding my class library to the fullTrustAssemblies element that I would be able to run the full trust code.  What am I missing:

[assembly: AllowPartiallyTrustedCallers]

namespace HelperLib
{
    public static class Helper
    {
        public static string CreateFile()
        {
            return DangerousWork();
        }

        [SecuritySafeCritical]
        [PermissionSet(SecurityAction.Assert, Unrestricted=true)]
        private static string DangerousWork()
        {
            string data = File.ReadAllText(&quot;c:\testfile.txt&quot;);

            return data;

        }
    }
}</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t making a lot of sense for those of us who don&#8217;t frequently touch CAS.  I&#8217;m trying the above in ASP.NET v4 and it&#8217;s throwing an InvalidOperationException: Cannot perform CAS Asserts in Security Transparent methods.  I get that ASP.NET v4 under medium trust runs in a security transparent manner.  I thought by adding my class library to the fullTrustAssemblies element that I would be able to run the full trust code.  What am I missing:</p>
<p>[assembly: AllowPartiallyTrustedCallers]</p>
<p>namespace HelperLib<br />
{<br />
    public static class Helper<br />
    {<br />
        public static string CreateFile()<br />
        {<br />
            return DangerousWork();<br />
        }</p>
<p>        [SecuritySafeCritical]<br />
        [PermissionSet(SecurityAction.Assert, Unrestricted=true)]<br />
        private static string DangerousWork()<br />
        {<br />
            string data = File.ReadAllText(&#8220;c:\testfile.txt&#8221;);</p>
<p>            return data;</p>
<p>        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

