<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" 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/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Wärting Innovative Solutions</title>
	
	<link>http://warting.se</link>
	<description>Wärtings blogg, här kan du se min portfolio och diverse webtips</description>
	<lastBuildDate>Mon, 19 Dec 2011 12:04:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/warting" /><feedburner:info uri="warting" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>warting</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Convert time greater than 24H in MsSQL</title>
		<link>http://feedproxy.google.com/~r/warting/~3/FZsLbTFC208/</link>
		<comments>http://warting.se/2011/12/19/convert-time-greater-than-24h-in-mssql/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 12:04:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>
		<category><![CDATA[MsSQL]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1526</guid>
		<description><![CDATA[If you have a time like 24:00 or even 28:12 in SQL and want to convert it to a normal time this is the way to do it: SELECT [time] = RIGHT(&#8217;0&#8242;+ RTRIM(CAST(substring(&#8217;28:12&#8242;,1,2)%24 as NCHAR(2))),2)+&#8217;:'+substring(&#8217;28:12&#8242;,4,5) Sample results: 08:00=08:00 23:45=23:45 24:00=00:00 28:12=04:12 If you know a better way, please let me know!]]></description>
			<content:encoded><![CDATA[<p>If you have a time like 24:00 or even 28:12 in SQL and want to convert it to a normal time this is the way to do it:</p>
<p>SELECT [time] = RIGHT(&#8217;0&#8242;+ RTRIM(CAST(substring(&#8217;28:12&#8242;,1,2)%24 as NCHAR(2))),2)+&#8217;:'+substring(&#8217;28:12&#8242;,4,5) </p>
<p>Sample results:<br />
08:00=08:00<br />
23:45=23:45<br />
24:00=00:00<br />
28:12=04:12</p>
<p>If you know a better way, please let me know!</p>
<img src="http://feeds.feedburner.com/~r/warting/~4/FZsLbTFC208" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/12/19/convert-time-greater-than-24h-in-mssql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/12/19/convert-time-greater-than-24h-in-mssql/</feedburner:origLink></item>
		<item>
		<title>Logout from all android activities</title>
		<link>http://feedproxy.google.com/~r/warting/~3/HAzED-DYp68/</link>
		<comments>http://warting.se/2011/12/05/logout-from-all-android-activities/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 07:45:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1520</guid>
		<description><![CDATA[If you have some activities in an android application and what to close all activities without having to worry about the back button, you can register a broadcast receiver that get triggered when you push the logout button. Lets create a new class that we can inherit on all activities that requires login: Then when [...]]]></description>
			<content:encoded><![CDATA[<p>If you have some activities in an android application and what to close all activities without having to worry about the back button, you can register a broadcast receiver that get triggered when you push the logout button.</p>
<p>Lets create a new class that we can inherit on all activities that requires login:</p>
<pre class="brush: java; title: ; notranslate">
public class LogedInActivity extends Activity {

	public class LogoutReceiver extends BroadcastReceiver {
		@Override
		public void onReceive(Context context, Intent intent) {
			if (intent.getAction().equals(&quot;com.package.ACTION_LOGOUT&quot;)) {
				finish();
			}
		}
	}

	private LogoutReceiver logoutReceiver;

	@Override
	protected void onDestroy() {
		// Unregister the logout receiver
		unregisterReceiver(logoutReceiver);
		super.onDestroy();
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		logoutReceiver = new LogoutReceiver();

		// Register the logout receiver
		IntentFilter intentFilter = new IntentFilter();
		intentFilter.addAction(&quot;com.package.ACTION_LOGOUT&quot;);
		registerReceiver(logoutReceiver, intentFilter);

	}

}
</pre>
<p>Then when you press the logout button you can close all open activities by just sending a broadcast intent:</p>
<pre class="brush: java; title: ; notranslate">
// on your logout method:
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(&quot;com.package.ACTION_LOGOUT&quot;);
c.sendBroadcast(broadcastIntent);
</pre>
<img src="http://feeds.feedburner.com/~r/warting/~4/HAzED-DYp68" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/12/05/logout-from-all-android-activities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/12/05/logout-from-all-android-activities/</feedburner:origLink></item>
		<item>
		<title>Design a splash screen for android</title>
		<link>http://feedproxy.google.com/~r/warting/~3/Edgn4pavalw/</link>
		<comments>http://warting.se/2011/11/07/design-a-splash-screen-for-android/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 08:32:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1514</guid>
		<description><![CDATA[Here is a good summary of what to consider when designing a splash screen for android: http://stackoverflow.com/questions/5523888/android-how-to-design-image-for-splash-screen]]></description>
			<content:encoded><![CDATA[<p>Here is a good summary of what to consider when designing a splash screen for android:</p>
<p><a  href="http://stackoverflow.com/questions/5523888/android-how-to-design-image-for-splash-screen">http://stackoverflow.com/questions/5523888/android-how-to-design-image-for-splash-screen</a></p>
<img src="http://feeds.feedburner.com/~r/warting/~4/Edgn4pavalw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/11/07/design-a-splash-screen-for-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/11/07/design-a-splash-screen-for-android/</feedburner:origLink></item>
		<item>
		<title>Simple PHP script to determine if a image is a valid 9 patch png image</title>
		<link>http://feedproxy.google.com/~r/warting/~3/ouHHKFM1VPQ/</link>
		<comments>http://warting.se/2011/09/22/simple-php-script-to-determine-if-a-image-is-a-valid-9-patch-png-image/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 17:52:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1495</guid>
		<description><![CDATA[This is a PHP script to determine if an image is an valid 9 patch PNG image that can be used in an android application]]></description>
			<content:encoded><![CDATA[<p>This is a PHP script to determine if an image is an valid 9 patch PNG image that can be used in an android application </p>
<pre class="brush: php; title: ; notranslate">
&lt;?php 

$src = dirname(__FILE__).'/btn.9.png'; //change me
if(function_exists('imagecreatefrompng') &amp;&amp; function_exists('imagecolorat')) {
	$isvalid = IsValid9PatchImage($src);
	print $src . ' is a ' . ($isvalid ? 'valid':'invalid') . ' 9patch image';
}
else {
	print &quot;Could not check if &quot;.$src.&quot; is a valid 9patch image. the php functions imagecreatefrompng and imagecolorat is required&quot;;
}

function IsValid9PatchImage($pngRel) {
	$im = imagecreatefrompng($pngRel);
	$height = imagesy($im);
	$width = imagesx($im);

	//Not a valid png image?
	if($height &lt;= 0 || $width &lt;= 0) {
		return false;
	}
	$anyBlack = false;
	for($x = 0; $x &lt; $width; $x++){
		$y = 0;
		$rgba = imagecolorat($im,$x,$y);
		$alpha = ($rgba &amp; 0x7F000000) &gt;&gt; 24;
		$red = ($rgba &amp; 0xFF0000) &gt;&gt; 16;
		$green = ($rgba &amp; 0x00FF00) &gt;&gt; 8;
		$blue = ($rgba &amp; 0x0000FF);

		$isAlpha = false;
		$isBlack = false;
		if($alpha == 0 &amp;&amp; $red == 0 &amp;&amp; $green == 0 &amp;&amp; $blue == 0) {
			$isBlack = true;
			$anyBlack = true;
		}
		else if($alpha == 127) {
			$isAlpha = true;
		}

		//If the top left pixel is not transparent then false
		if($x == 0 &amp;&amp; $isAlpha == false) {
			//die('If the top left pixel is not transparent then false. x:' . $x . ' y:' . $y);
			return false;
		}

		//If the top right pixel is not transparent then false
		if($x == $width-1 &amp;&amp; $isAlpha == false) {
			//die('If the top right pixel is not transparent then false. x:' . $x . ' y:' . $y);
			return false;
		}

		//If it is not completly transparent or black, then false
		if(!$isAlpha &amp;&amp; !$isBlack) {
			//die('If it is not completly transparent or black, then false. x:' . $x . ' y:' . $y);
			return false;
		}
	}
	if($!anyBlack) {
		return false;
	}

	$anyBlack = false;
	for($y = 0; $y &lt; $height; $y++){
		$x = 0;
		$rgba = imagecolorat($im,$x,$y);
		$alpha = ($rgba &amp; 0x7F000000) &gt;&gt; 24;
		$red = ($rgba &amp; 0xFF0000) &gt;&gt; 16;
		$green = ($rgba &amp; 0x00FF00) &gt;&gt; 8;
		$blue = ($rgba &amp; 0x0000FF);

		$isAlpha = false;
		$isBlack = false;
		if($alpha == 0 &amp;&amp; $red == 0 &amp;&amp; $green == 0 &amp;&amp; $blue == 0) {
			$isBlack = true;
			$anyBlack = true;
		}
		else if($alpha == 127) {
			$isAlpha = true;
		}

		//If the top left pixel is not transparent then false
		if($y == 0 &amp;&amp; $isAlpha == false) {
			//die('If the top left pixel is not transparent then false. x:' . $x . ' y:' . $y);
			return false;
		}

		//If the top right pixel is not transparent then false
		if($y == $width-1 &amp;&amp; $isAlpha == false) {
			//die('If the top right pixel is not transparent then false. x:' . $x . ' y:' . $y);
			return false;
		}

		//If it is not completly transparent or black, then false
		if(!$isAlpha &amp;&amp; !$isBlack) {
			//die('If it is not completly transparent or black, then false. x:' . $x . ' y:' . $y);
			return false;
		}
	}
	if($!anyBlack) {
		return false;
	}

	return true;
}

?&gt;
</pre>
<img src="http://feeds.feedburner.com/~r/warting/~4/ouHHKFM1VPQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/09/22/simple-php-script-to-determine-if-a-image-is-a-valid-9-patch-png-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/09/22/simple-php-script-to-determine-if-a-image-is-a-valid-9-patch-png-image/</feedburner:origLink></item>
		<item>
		<title>Easy tool to draw a nine patch image</title>
		<link>http://feedproxy.google.com/~r/warting/~3/IYScg-vpsII/</link>
		<comments>http://warting.se/2011/08/28/easy-tool-to-draw-a-nine-patch-image/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 08:54:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1472</guid>
		<description><![CDATA[ I have created a new tool to to draw a nine patch image for android online. Its free and easy to use! Please try it out: http://draw9patch.com/]]></description>
			<content:encoded><![CDATA[<div>
<p> I have created a new tool to to draw a nine patch image for android online. Its free and easy to use!</p>
<p>Please try it out: <a  href="http://draw9patch.com/">http://draw9patch.com/</a></p>
<p><a  href="http://warting.se/wp-content/uploads/2011/08/Screen-shot-2011-08-28-at-10.54.25.png" class="thickbox no_icon" rel="gallery-1472" title="Screen shot 2011-08-28 at 10.54.25"><img class="alignnone size-medium wp-image-1473" title="Screen shot 2011-08-28 at 10.54.25" src="http://warting.se/wp-content/uploads/2011/08/Screen-shot-2011-08-28-at-10.54.25-300x163.png" alt="" width="300" height="163" /></a></p>
</div>
<img src="http://feeds.feedburner.com/~r/warting/~4/IYScg-vpsII" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/08/28/easy-tool-to-draw-a-nine-patch-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/08/28/easy-tool-to-draw-a-nine-patch-image/</feedburner:origLink></item>
		<item>
		<title>Make Eclipse use UTF-8 as default</title>
		<link>http://feedproxy.google.com/~r/warting/~3/iOn2XUFW07U/</link>
		<comments>http://warting.se/2011/07/12/make-eclipse-use-utf-8-as-default/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 12:00:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1464</guid>
		<description><![CDATA[To make Eclipse always use utf-8 even when creating new workspace you can just add a single line in eclipse.ini -Dfile.encoding=UTF-8 &#160;]]></description>
			<content:encoded><![CDATA[<p>To make Eclipse always use utf-8 even when creating new workspace you can just add a single line in eclipse.ini</p>
<p>-Dfile.encoding=UTF-8</p>
<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/warting/~4/iOn2XUFW07U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/07/12/make-eclipse-use-utf-8-as-default/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://warting.se/2011/07/12/make-eclipse-use-utf-8-as-default/</feedburner:origLink></item>
		<item>
		<title>Debug images in Visual Studio</title>
		<link>http://feedproxy.google.com/~r/warting/~3/tcoaif7nupw/</link>
		<comments>http://warting.se/2011/05/19/debug-images-in-visual-studio/#comments</comments>
		<pubDate>Thu, 19 May 2011 11:04:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>
		<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1455</guid>
		<description><![CDATA[With a few lines of code you can easily display image objects when debugging image object in visual studio. I have compile a DLL (with the source code taken from codeproject) Download ImageVisualizer.dll and put the dll in &#8220;C:\Users\{Username}\Documents\Visual Studio {Version}\Visualizers&#8221; &#160;]]></description>
			<content:encoded><![CDATA[<p>With a few lines of code you can easily display image objects when debugging image object in visual studio.</p>
<p>I have compile a DLL (with the source code taken from <a  href="http://www.codeproject.com/KB/trace/ImageVisualizer.aspx">codeproject</a>)</p>
<p>Download <a  href="http://warting.se/wp-content/uploads/2011/05/ImageVisualizer.zip">ImageVisualizer.dll</a> and put the dll in &#8220;C:\Users\{Username}\Documents\Visual Studio {Version}\Visualizers&#8221;</p>
<p>&nbsp;</p>
<p><a  href="http://warting.se/wp-content/uploads/2011/05/ImageVisualizer.png" class="thickbox no_icon" rel="gallery-1455" title="ImageVisualizer"><img class="alignnone size-full wp-image-1459" title="ImageVisualizer" src="http://warting.se/wp-content/uploads/2011/05/ImageVisualizer.png" alt="" width="494" height="229" /></a></p>
<img src="http://feeds.feedburner.com/~r/warting/~4/tcoaif7nupw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/05/19/debug-images-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/05/19/debug-images-in-visual-studio/</feedburner:origLink></item>
		<item>
		<title>XForm AfterSubmitPostedData is not triggered</title>
		<link>http://feedproxy.google.com/~r/warting/~3/UyijJi4VeQI/</link>
		<comments>http://warting.se/2011/05/10/xform-aftersubmitposteddata-is-not-triggered/#comments</comments>
		<pubDate>Tue, 10 May 2011 12:15:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[EPiServer]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1437</guid>
		<description><![CDATA[In EPiServers public template they have given me a nice way to redirect the user after a XForm have been submitted by hooking up on the AfterSubmitPostedData event. If XForm_AfterSubmitPostedData is never triggered this is probably because the SMTP settings is wrong in web.config(!!?). IMOHO this is a bug and a very stupid way to handle [...]]]></description>
			<content:encoded><![CDATA[<p>In EPiServers public template they have given me a nice way to redirect the user after a XForm have been submitted by hooking up on the AfterSubmitPostedData event.</p>
<pre class="brush: csharp; title: ; notranslate">
        public void XForm_ControlSetup(object sender, EventArgs e)
        {
                var control = (XFormControl)sender;
                control.AfterSubmitPostedData += XForm_AfterSubmitPostedData;
        }

        public void XForm_AfterSubmitPostedData(object sender, SaveFormDataEventArgs e)
        {
            var control = (XFormControl)sender;

            if (control.FormDefinition.PageGuidAfterPost != Guid.Empty)
            {
                var pageMap = PermanentLinkMapStore.Find(control.FormDefinition.PageGuidAfterPost) as PermanentPageLinkMap;
                if (pageMap != null)
                {
                    control.Page.Response.Redirect(pageMap.MappedUrl.ToString());
                    return;
                }
            }
        }
</pre>
<p>If XForm_AfterSubmitPostedData is never triggered this is probably because the SMTP settings is wrong in web.config(!!?).</p>
<p>IMOHO this is a bug and a very stupid way to handle this error, episerver should throw an exception!</p>
<p>Anyway&#8230; go ahead and download <a  href="http://smtp4dev.codeplex.com/">smtp4dev</a> which is a great dummy SMTP server for developers. And then change the SMTP settings in web.config to something like this:</p>
<pre class="brush: xml; title: ; notranslate">
    &lt;mailSettings&gt;
      &lt;smtp from=&quot;noreply@dummy.com&quot; deliveryMethod=&quot;Network&quot;&gt;
        &lt;network host=&quot;localhost&quot; port=&quot;25&quot; userName=&quot;&quot; password=&quot;&quot; defaultCredentials=&quot;false&quot; /&gt;
      &lt;/smtp&gt;
    &lt;/mailSettings&gt;
</pre>
<p>Voila!</p>
<img src="http://feeds.feedburner.com/~r/warting/~4/UyijJi4VeQI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/05/10/xform-aftersubmitposteddata-is-not-triggered/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://warting.se/2011/05/10/xform-aftersubmitposteddata-is-not-triggered/</feedburner:origLink></item>
		<item>
		<title>Authenticate user in C# without username and password</title>
		<link>http://feedproxy.google.com/~r/warting/~3/xRZGmsgGjKU/</link>
		<comments>http://warting.se/2011/02/16/authenticate-user-in-c-without-username-and-password/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 12:18:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1412</guid>
		<description><![CDATA[If you want to authenticate a user based on an ip or whatever this is a good method to use in global.asax: You could use only &#8220;FormsAuthentication.SetAuthCookie" but in that case you are not logged in before next request.]]></description>
			<content:encoded><![CDATA[<p>If you want to authenticate a user based on an ip or whatever this is a good method to use in global.asax:</p>
<pre class="brush: csharp; title: ; notranslate">
void Session_Start(object sender, EventArgs e)
{
 string ip = ConfigurationManager.AppSettings[&quot;AutoLoginIp&quot;];
 if (Request.UserHostAddress != null &amp;&amp; Request.UserHostAddress.Equals(ip))
 {
 LoginAs(&quot;theUserName&quot;);
 }
}

public void LoginAs(string username)
{
 FormsAuthentication.SetAuthCookie(username, false);
 System.Web.HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
 if (authCookie != null)
 {
 FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

 if (authTicket != null &amp;&amp; !authTicket.Expired)
 {
 FormsAuthenticationTicket newAuthTicket = authTicket;

 if (FormsAuthentication.SlidingExpiration)
 {
 newAuthTicket = FormsAuthentication.RenewTicketIfOld(authTicket);
 }
 if (newAuthTicket != null)
 {
 string userData = newAuthTicket.UserData;
 string[] roles = userData.Split(',');

 System.Web.HttpContext.Current.User =
 new System.Security.Principal.GenericPrincipal(new FormsIdentity(newAuthTicket), roles);
 }
 }
 }
}
</pre>
<p>You could use only &#8220;<code>FormsAuthentication.SetAuthCookie" but in that case you are not logged in before next request.</code></pre>
<img src="http://feeds.feedburner.com/~r/warting/~4/xRZGmsgGjKU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/02/16/authenticate-user-in-c-without-username-and-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/02/16/authenticate-user-in-c-without-username-and-password/</feedburner:origLink></item>
		<item>
		<title>Remove parent-inherited ACL role on creating a page</title>
		<link>http://feedproxy.google.com/~r/warting/~3/f2maePHhHmg/</link>
		<comments>http://warting.se/2011/01/04/remove-role-from-paren/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 16:14:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blogg]]></category>
		<category><![CDATA[EPiServer]]></category>

		<guid isPermaLink="false">http://warting.se/?p=1359</guid>
		<description><![CDATA[When creating a page in EPiServer the page inherits the parent&#8217;s ACL. To remove a role in the on create page event you need the following:]]></description>
			<content:encoded><![CDATA[<p>When creating a page in EPiServer the page inherits the parent&#8217;s ACL.</p>
<p>To remove a role in the on create page event you need the following:</p>
<pre class="brush: csharp; title: ; notranslate">
private static void Instance_CreatedPage(object sender, PageEventArgs e)
{
   if (e.Page != null)
   {
      var kb = e.Page;
      var acl = new PageAccessControlList(kb.PageLink)
         {
            new AccessControlEntry(&quot;Everyone&quot;, AccessLevel.NoAccess, SecurityEntityType.Role),
            new AccessControlEntry(&quot;AnotherRole&quot;, AccessLevel.NoAccess, SecurityEntityType.Role),
            new AccessControlEntry(&quot;UserName&quot;, AccessLevel.NoAccess, SecurityEntityType.User)
         };
      acl.Save();
   }
}
</pre>
<img src="http://feeds.feedburner.com/~r/warting/~4/f2maePHhHmg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://warting.se/2011/01/04/remove-role-from-paren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://warting.se/2011/01/04/remove-role-from-paren/</feedburner:origLink></item>
	</channel>
</rss>

