<?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"
	>
<channel>
	<title>Comments on: Is EpiServer a hard-shelled clam or what?</title>
	<atom:link href="http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/</link>
	<description>Code and Effect - solving problem with just enough amount of code - by Adam Najmanowicz</description>
	<pubDate>Tue, 06 Jan 2009 06:28:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Adam Najmanowicz</title>
		<link>http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/#comment-3505</link>
		<dc:creator>Adam Najmanowicz</dc:creator>
		<pubDate>Fri, 31 Aug 2007 11:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/#comment-3505</guid>
		<description>Steve, I am as far as possible from critiquing the code, it's working within the bounds that are set by Episerver- hence the post title.  I have to admit, I was not aware of the possibility of pulling the page with no access, which, although possible still seems to be more of a workaround rather than a solution. After all - I'm not interested in the page content but rather with its metadata. an ideal solution would be to be able to query access AND existence against a page PageReference, which I am able to do with file without opening it.

Dariusz - if I'm not mistaken, QueryDistinctAccess works only on a page that exist and one that you've already Getpage()-ed - and then, the solution for page that has been deleted form the system is outstanding from it. What I'm thinking of would be a simple extension to ACL indeed that could even be static but would accept a page reference in addition to SID and AccessControlList.NoAccess.

GetPage is really heavy for a way to query a page access - I'm currently evaluating an EpiServer project that nearly failed performacne wise and we-ve just profiled it and the poor performance is mostly attributed to an excessive GetPage() calls that are taking up to 75% of whole CPU time spent within the application.</description>
		<content:encoded><![CDATA[<p>Steve, I am as far as possible from critiquing the code, it&#8217;s working within the bounds that are set by Episerver- hence the post title.  I have to admit, I was not aware of the possibility of pulling the page with no access, which, although possible still seems to be more of a workaround rather than a solution. After all - I&#8217;m not interested in the page content but rather with its metadata. an ideal solution would be to be able to query access AND existence against a page PageReference, which I am able to do with file without opening it.</p>
<p>Dariusz - if I&#8217;m not mistaken, QueryDistinctAccess works only on a page that exist and one that you&#8217;ve already Getpage()-ed - and then, the solution for page that has been deleted form the system is outstanding from it. What I&#8217;m thinking of would be a simple extension to ACL indeed that could even be static but would accept a page reference in addition to SID and AccessControlList.NoAccess.</p>
<p>GetPage is really heavy for a way to query a page access - I&#8217;m currently evaluating an EpiServer project that nearly failed performacne wise and we-ve just profiled it and the poor performance is mostly attributed to an excessive GetPage() calls that are taking up to 75% of whole CPU time spent within the application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/#comment-3474</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 30 Aug 2007 18:33:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/#comment-3474</guid>
		<description>I see your point, and I agree that exceptions should not be the driving force of program flow. 

For the PageNotFoundException exception, there really is no other way to do this, as far as I know. We have what we think is a valid PageReference, but it is in fact not. I guess the API could return null for doing a GetPage on a non existing page, but these references are scattered around in markup and code, and the PageNotFoundException is a better error to show than the NullReferenceException on the first line that was actually trying to use the null'ed PageData object you just recieved. :-)

If you want to check if the user has access to the page, you will need to load it using the GetPage overload in the DataFactory:
PageData pd = Global.EPDataFactory.GetPage(myRef, AccessControlList.NoAccess);
This code gets the page, without checking the security (I know, it is a bad enum name, read it as "NoAccessCheck" to remember the difference.)

Then you can check the access right by looking at the ACL property (and its Query methods.) 

To my defence (I wrote the code above) I did not really care what access rights the user have on that page. If she cannot see it, I'm skipping it. Checking the rights means I have to load it into memory anyway, and the cost of an exception in contrast to that can be ignored.</description>
		<content:encoded><![CDATA[<p>I see your point, and I agree that exceptions should not be the driving force of program flow. </p>
<p>For the PageNotFoundException exception, there really is no other way to do this, as far as I know. We have what we think is a valid PageReference, but it is in fact not. I guess the API could return null for doing a GetPage on a non existing page, but these references are scattered around in markup and code, and the PageNotFoundException is a better error to show than the NullReferenceException on the first line that was actually trying to use the null&#8217;ed PageData object you just recieved. :-)</p>
<p>If you want to check if the user has access to the page, you will need to load it using the GetPage overload in the DataFactory:<br />
PageData pd = Global.EPDataFactory.GetPage(myRef, AccessControlList.NoAccess);<br />
This code gets the page, without checking the security (I know, it is a bad enum name, read it as &#8220;NoAccessCheck&#8221; to remember the difference.)</p>
<p>Then you can check the access right by looking at the ACL property (and its Query methods.) </p>
<p>To my defence (I wrote the code above) I did not really care what access rights the user have on that page. If she cannot see it, I&#8217;m skipping it. Checking the rights means I have to load it into memory anyway, and the cost of an exception in contrast to that can be ignored.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dariusz Macina</title>
		<link>http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/#comment-3472</link>
		<dc:creator>Dariusz Macina</dc:creator>
		<pubDate>Thu, 30 Aug 2007 18:17:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.najmanowicz.com/2007/08/30/is-episerver-a-hard-shelled-clam-or-what/#comment-3472</guid>
		<description>Why can't you just use QueryDistinctAccess to check if CurrentUser has enough rights to access the page?</description>
		<content:encoded><![CDATA[<p>Why can&#8217;t you just use QueryDistinctAccess to check if CurrentUser has enough rights to access the page?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
