<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>www.leastprivilege.com</title>
    <link>http://www.leastprivilege.com/</link>
    <description>dominick baier on .net, security and other stuff</description>
    <image>
      <url>http://www.leastprivilege.com/favicon.ico</url>
      <title>www.leastprivilege.com</title>
      <link>http://www.leastprivilege.com/</link>
    </image>
    <copyright>Dominick Baier</copyright>
    <lastBuildDate>Wed, 02 Jul 2008 21:13:54 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.8.5223.2</generator>
    <managingEditor>dbaier@pleasepleasenospam_leastprivilege.com</managingEditor>
    <webMaster>dbaier@pleasepleasenospam_leastprivilege.com</webMaster>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=b550b5f7-d5f6-47de-a5e0-4def7c663f20</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=b550b5f7-d5f6-47de-a5e0-4def7c663f20</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=b550b5f7-d5f6-47de-a5e0-4def7c663f20</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b550b5f7-d5f6-47de-a5e0-4def7c663f20</wfw:commentRss>
      <title>Using IdentityModel: Useful Extension Methods for Serializing Claim Sets</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=b550b5f7-d5f6-47de-a5e0-4def7c663f20</guid>
      <link>http://www.leastprivilege.com/UsingIdentityModelUsefulExtensionMethodsForSerializingClaimSets.aspx</link>
      <pubDate>Wed, 02 Jul 2008 21:13:54 GMT</pubDate>
      <description>&lt;p&gt;
   As a follow up to my last post - the following extension methods make it easy to manually
   serialize claim sets:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XElement&lt;/span&gt; Serialize(&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;this&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt; set, &lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Type&lt;/span&gt;&amp;gt;
   knownTypes)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt; dcs
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt;(&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;set.GetType(),&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;knownTypes,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt;.MaxValue,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;false&lt;/span&gt;,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;true&lt;/span&gt;,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt; ms
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;MemoryStream&lt;/span&gt;();&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;dcs.WriteObject(ms, set);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ms.Seek(0, &lt;span style="color: #2b91af"&gt;SeekOrigin&lt;/span&gt;.Begin);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XElement&lt;/span&gt;.Load(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XmlTextReader&lt;/span&gt;(ms));&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;
   &lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span lang="EN-US" style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-us; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XElement&lt;/span&gt; Serialize(&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;this&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt;&amp;gt;
   claimSets, &lt;span style="color: blue"&gt;string&lt;/span&gt; rootName, 
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; rootNamespace, &lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Type&lt;/span&gt;&amp;gt;
   knownTypes)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;XNamespace&lt;/span&gt; ns
   = &lt;span style="color: #2b91af"&gt;XNamespace&lt;/span&gt;.Get(rootNamespace);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XElement&lt;/span&gt;(ns
   + rootName,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;from&lt;/span&gt; cs &lt;span style="color: blue"&gt;in&lt;/span&gt; claimSets&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;select&lt;/span&gt; cs.Serialize(knownTypes));&lt;br&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=b550b5f7-d5f6-47de-a5e0-4def7c663f20" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=b550b5f7-d5f6-47de-a5e0-4def7c663f20</comments>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=05e9088f-0faf-4485-94e2-3fb1e1ada472</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=05e9088f-0faf-4485-94e2-3fb1e1ada472</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=05e9088f-0faf-4485-94e2-3fb1e1ada472</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=05e9088f-0faf-4485-94e2-3fb1e1ada472</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Quoting <a href="http://www.pluralsight.com/community/blogs/brian/archive/2008/07/01/a-new-year-starts.aspx">Brian</a>:
   </p>
        <p>
      "Microsoft has decided I didn't cause too much trouble over the last 12 months so
      I get to continue being a <font color="#0000ff">{0}</font> MVP. Thanks!", <font color="#0000ff">"Developer
      Security"</font></p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=05e9088f-0faf-4485-94e2-3fb1e1ada472" />
      </body>
      <title>Re:MVP</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=05e9088f-0faf-4485-94e2-3fb1e1ada472</guid>
      <link>http://www.leastprivilege.com/ReMVP.aspx</link>
      <pubDate>Wed, 02 Jul 2008 20:53:58 GMT</pubDate>
      <description>&lt;p&gt;
   Quoting &lt;a href="http://www.pluralsight.com/community/blogs/brian/archive/2008/07/01/a-new-year-starts.aspx"&gt;Brian&lt;/a&gt;:
&lt;/p&gt;
&lt;p&gt;
   "Microsoft has decided I didn't cause too much trouble over the last 12 months so
   I get to continue being a &lt;font color="#0000ff"&gt;{0}&lt;/font&gt; MVP. Thanks!", &lt;font color="#0000ff"&gt;"Developer
   Security"&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=05e9088f-0faf-4485-94e2-3fb1e1ada472" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=05e9088f-0faf-4485-94e2-3fb1e1ada472</comments>
      <category>Misc</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=bdbba2ce-c51e-4a2a-b223-b18a5cb5c9ae</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=bdbba2ce-c51e-4a2a-b223-b18a5cb5c9ae</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=bdbba2ce-c51e-4a2a-b223-b18a5cb5c9ae</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bdbba2ce-c51e-4a2a-b223-b18a5cb5c9ae</wfw:commentRss>
      <title>Using IdentityModel: Serializing Claim Sets</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=bdbba2ce-c51e-4a2a-b223-b18a5cb5c9ae</guid>
      <link>http://www.leastprivilege.com/UsingIdentityModelSerializingClaimSets.aspx</link>
      <pubDate>Wed, 02 Jul 2008 08:00:28 GMT</pubDate>
      <description>&lt;p&gt;
   Both &lt;em&gt;Claim&lt;/em&gt; and &lt;em&gt;ClaimSet&lt;/em&gt; are decorated with &lt;em&gt;DataContract/DataMember&lt;/em&gt; attributes.
   This means they are made for serialization. And this makes sense - maybe you want
   to forward a claim set (server to server) or send a claim set from server to client
   (UI authorization).
&lt;/p&gt;
&lt;p&gt;
   But you will most likely run into problems when trying to serialize a claim set using
   the &lt;em&gt;DataContractSerializer&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Known Types&lt;br&gt;
   &lt;/strong&gt;DCS needs to 'know' all types that are involved in the serialization process.
   This involves every type in the inheritance chain down to ClaimSet (e.g. &lt;em&gt;DefaultClaimSet&lt;/em&gt; or
   my &lt;em&gt;DeferredLoadClaimSet&lt;/em&gt;) as well as all possible resource types. You either
   supply the known types via attributes/config (&lt;em&gt;KnownType&lt;/em&gt; and &lt;em&gt;ServiceKnownType&lt;/em&gt;).
&lt;/p&gt;
&lt;p&gt;
   Or you supply the types when newing up the DCS manually:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span lang="EN-US" style="color: #2b91af; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us"&gt;DataContractSerializer&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us"&gt; dcs
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt;(&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt;),&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Type&lt;/span&gt;&amp;gt;
   { &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;DefaultClaimSet&lt;/span&gt;), &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;UIClaimResource&lt;/span&gt;&lt;?xml:namespace prefix = o /&gt;)
   });&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Circular References&lt;br&gt;
   &lt;/strong&gt;Typical claim sets will have circular references - e.g. when the last issuer
   in the chain points to himself. DCS is not made for cyclic reference - but rather
   object trees (at least with the default settings). When you are trying to serialize
   objects with cyclic references you will get the following exception : "type contains
   cycles and cannot be serialized if reference tracking is disabled.". In WCF traces
   you will see something like "message not logged because its size exceeds configured
   quota".
&lt;/p&gt;
&lt;p&gt;
   When newing up a DCS you can opt for "preserving object references". This will create
   ID/IDREF pairs in the serialized XML and allows for type references and thus cycles.
   (Aaron has an &lt;a href="http://www.pluralsight.com/community/blogs/aaron/archive/2008/05/14/50943.aspx"&gt;explanation&lt;/a&gt; of
   how that works).
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span lang="EN-US" style="color: #2b91af; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us"&gt;DataContractSerializer&lt;/span&gt;&lt;span lang="EN-US" style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-ansi-language: en-us"&gt; dcs
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt;(&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt;),&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Type&lt;/span&gt;&amp;gt;
   { &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;DefaultClaimSet&lt;/span&gt;), &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;UIClaimResource&lt;/span&gt;)
   },&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt;.MaxValue,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;true&lt;/span&gt;,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;true&lt;/span&gt;,&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;//
   preserveObjectReferences&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   This is fine when you can control the DCS parameters. But you can't easily do that
   in WCF. Sowmy has a &lt;a href="http://blogs.msdn.com/sowmy/archive/2006/03/26/561188.aspx"&gt;sample&lt;/a&gt; on
   how to enable reference preserving in WCF. This will solve the problem!
&lt;/p&gt;
&lt;span style="font-size: 11pt; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: de; mso-fareast-language: en-us; mso-bidi-language: ar-sa"&gt;[&lt;span style="color: #2b91af"&gt;OperationContract&lt;/span&gt;]&lt;br&gt;
[&lt;span style="color: #2b91af"&gt;ReferencePreservingDataContractFormat&lt;/span&gt;]&lt;br&gt;
&lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt; GetClaims();&lt;/span&gt; 
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;3.5 SP1 to the Rescue!?&lt;/strong&gt;
   &lt;br&gt;
   Starting with 3.5 SP1 you can enable reference preserving on a &lt;em&gt;DataContract&lt;/em&gt; like
   this:
&lt;/p&gt;
&lt;span lang="EN-US" style="font-size: 11pt; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa"&gt;[&lt;span style="color: #2b91af"&gt;DataContract&lt;/span&gt;(Namespace
= &lt;span style="color: #a31515"&gt;"..."&lt;/span&gt;, &lt;b style="mso-bidi-font-weight: normal"&gt;IsReference
= &lt;span style="color: blue"&gt;true&lt;/span&gt;&lt;/b&gt;)]&lt;br&gt;
&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;abstract&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DeferredLoadClaimSet&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   But there are two problems with this approach:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      You actually need access to the DataContract to change the attribute. In the claims
      case - you would need to change the framework's &lt;em&gt;DefaultClaimSet&lt;/em&gt; or your own &lt;em&gt;ClaimSet&lt;/em&gt;-derived
      class.&lt;/li&gt;
   &lt;li&gt;
      Every &lt;em&gt;DataContract&lt;/em&gt; in the inheritance chain needs the &lt;em&gt;IsReference&lt;/em&gt; attribute
      - otherwise you will get the following error: "Derived types must have the same value
      for IsReference as the base type". Since all custom claim sets ultimately derive from &lt;em&gt;ClaimSet&lt;/em&gt; -
      but this &lt;em&gt;DataContract&lt;/em&gt; has no &lt;em&gt;IsReference&lt;/em&gt; set, we are back to square
      one.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Conclusion&lt;/strong&gt;
   &lt;br&gt;
   Keep these things in mind when serializing claim sets:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      supply all involved types as known types&lt;/li&gt;
   &lt;li&gt;
      Set &lt;em&gt;preserveObjectReferences&lt;/em&gt; to true on the DCS. The new attribute on &lt;em&gt;DataContract&lt;/em&gt; in
      3.5 SP1 is nice - but does not help with claim sets. Use the [ReferencePreservingDataContractFormat]
      attribute instead (find the code &lt;a href="http://blogs.msdn.com/sowmy/attachment/561188.ashx"&gt;here&lt;/a&gt;).&lt;/li&gt;
   &lt;li&gt;
      Reference preserving adds ID/IDREF attributes to the resulting XML. These attributes
      come from a Microsoft namespace. This may be a problem for interop scenarios. If you
      need full control over the XML, either use the DCS extensibility points for manual
      serialization, or don't use the DCS at all (and use one of the alternative message
      generation mechanisms). Another option would be to use a more standardized serialization
      format for claims like a SAML token.&lt;/li&gt;
   &lt;li&gt;
      &lt;em&gt;WindowsClaimSet&lt;/em&gt; and &lt;em&gt;X509CertificateClaimSet&lt;/em&gt; are not marked with
      [DataContract] at all - they are not intended for serialization.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=bdbba2ce-c51e-4a2a-b223-b18a5cb5c9ae" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=bdbba2ce-c51e-4a2a-b223-b18a5cb5c9ae</comments>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=01ad0c4b-2601-4ac6-b4dd-83809f43115f</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=01ad0c4b-2601-4ac6-b4dd-83809f43115f</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=01ad0c4b-2601-4ac6-b4dd-83809f43115f</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=01ad0c4b-2601-4ac6-b4dd-83809f43115f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Putting <a href="http://www.tavaresstudios.com/Blog/post/The-last-vsvars32ps1-Ill-ever-need.aspx">these</a><a href="http://www.leastprivilege.com/MyMonadCommandPrompt.aspx">three</a><a href="http://www.leastprivilege.com/AdminTitleBarForPowerShell.aspx">things</a> (and
      a little bit of <a href="http://www.interact-sw.co.uk/iangblog/2007/02/09/pshdetectelevation">this</a>)
      together - you can build a very nice profile script for PowerShell ;)
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=01ad0c4b-2601-4ac6-b4dd-83809f43115f" />
      </body>
      <title>PowerShell Profile</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=01ad0c4b-2601-4ac6-b4dd-83809f43115f</guid>
      <link>http://www.leastprivilege.com/PowerShellProfile.aspx</link>
      <pubDate>Sun, 15 Jun 2008 14:44:38 GMT</pubDate>
      <description>&lt;p&gt;
   Putting &lt;a href="http://www.tavaresstudios.com/Blog/post/The-last-vsvars32ps1-Ill-ever-need.aspx"&gt;these&lt;/a&gt; &lt;a href="http://www.leastprivilege.com/MyMonadCommandPrompt.aspx"&gt;three&lt;/a&gt; &lt;a href="http://www.leastprivilege.com/AdminTitleBarForPowerShell.aspx"&gt;things&lt;/a&gt; (and
   a little bit of &lt;a href="http://www.interact-sw.co.uk/iangblog/2007/02/09/pshdetectelevation"&gt;this&lt;/a&gt;)
   together - you can build a very nice profile script for PowerShell ;)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=01ad0c4b-2601-4ac6-b4dd-83809f43115f" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=01ad0c4b-2601-4ac6-b4dd-83809f43115f</comments>
      <category>Work in Progress</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=bf0ddd2a-8712-4777-90a1-3a7492511bd9</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=bf0ddd2a-8712-4777-90a1-3a7492511bd9</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=bf0ddd2a-8712-4777-90a1-3a7492511bd9</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=bf0ddd2a-8712-4777-90a1-3a7492511bd9</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Great article about IIS 7 configuration extensibility:
   </p>
        <p>
          <a title="http://learn.iis.net/page.aspx/241/configuration-extensibility/" href="http://learn.iis.net/page.aspx/241/configuration-extensibility/">http://learn.iis.net/page.aspx/241/configuration-extensibility/</a>
        </p>
        <p>
      Especially infos about the COM backed extensions are hard to find elsewhere...
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=bf0ddd2a-8712-4777-90a1-3a7492511bd9" />
      </body>
      <title>Advanced Extensions to IIS 7 Configuration</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=bf0ddd2a-8712-4777-90a1-3a7492511bd9</guid>
      <link>http://www.leastprivilege.com/AdvancedExtensionsToIIS7Configuration.aspx</link>
      <pubDate>Thu, 12 Jun 2008 22:55:59 GMT</pubDate>
      <description>&lt;p&gt;
   Great article about IIS 7 configuration extensibility:
&lt;/p&gt;
&lt;p&gt;
   &lt;a title="http://learn.iis.net/page.aspx/241/configuration-extensibility/" href="http://learn.iis.net/page.aspx/241/configuration-extensibility/"&gt;http://learn.iis.net/page.aspx/241/configuration-extensibility/&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   Especially infos about the COM backed extensions are hard to find elsewhere...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=bf0ddd2a-8712-4777-90a1-3a7492511bd9" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=bf0ddd2a-8712-4777-90a1-3a7492511bd9</comments>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=c0ebf17c-d5ac-423a-9d49-27200a5d99fc</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=c0ebf17c-d5ac-423a-9d49-27200a5d99fc</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=c0ebf17c-d5ac-423a-9d49-27200a5d99fc</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c0ebf17c-d5ac-423a-9d49-27200a5d99fc</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Thanks to everyone who attended my IdentityModel talk at <a href="http://www.software-architect.co.uk/">Software
      Architect</a>.
   </p>
        <p>
      You can have all the code I showed you during my talk - just send me a private message
      or leave a comment. Most of the demos are online anyways - have a look at my IdentityModel <a href="http://www.leastprivilege.com/IdentityModel">micro-site</a>.
   </p>
        <p>
      Questions and feedback are more than welcome. Happy identity-ing.
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c0ebf17c-d5ac-423a-9d49-27200a5d99fc" />
      </body>
      <title>Software Architect 2008</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=c0ebf17c-d5ac-423a-9d49-27200a5d99fc</guid>
      <link>http://www.leastprivilege.com/SoftwareArchitect2008.aspx</link>
      <pubDate>Sat, 07 Jun 2008 04:44:43 GMT</pubDate>
      <description>&lt;p&gt;
   Thanks to everyone who attended my IdentityModel talk at &lt;a href="http://www.software-architect.co.uk/"&gt;Software
   Architect&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   You can have all the code I showed you during my talk - just send me a private message
   or leave a comment. Most of the demos are online anyways - have a look at my IdentityModel &lt;a href="http://www.leastprivilege.com/IdentityModel"&gt;micro-site&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
   Questions and feedback are more than welcome. Happy identity-ing.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=c0ebf17c-d5ac-423a-9d49-27200a5d99fc" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=c0ebf17c-d5ac-423a-9d49-27200a5d99fc</comments>
      <category>Conferences;IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=d7d81925-ba58-4281-95dd-c53d9ea98533</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=d7d81925-ba58-4281-95dd-c53d9ea98533</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=d7d81925-ba58-4281-95dd-c53d9ea98533</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d7d81925-ba58-4281-95dd-c53d9ea98533</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Good walkthrough here:
   </p>
        <p>
          <a title="http://learn.iis.net/page.aspx/441/understanding-ui-extension-authoring/" href="http://learn.iis.net/page.aspx/441/understanding-ui-extension-authoring/">http://learn.iis.net/page.aspx/441/understanding-ui-extension-authoring/</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d7d81925-ba58-4281-95dd-c53d9ea98533" />
      </body>
      <title>Writing IIS 7 Manager Extensions</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=d7d81925-ba58-4281-95dd-c53d9ea98533</guid>
      <link>http://www.leastprivilege.com/WritingIIS7ManagerExtensions.aspx</link>
      <pubDate>Thu, 05 Jun 2008 09:16:30 GMT</pubDate>
      <description>&lt;p&gt;
   Good walkthrough here:
&lt;/p&gt;
&lt;p&gt;
   &lt;a title="http://learn.iis.net/page.aspx/441/understanding-ui-extension-authoring/" href="http://learn.iis.net/page.aspx/441/understanding-ui-extension-authoring/"&gt;http://learn.iis.net/page.aspx/441/understanding-ui-extension-authoring/&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d7d81925-ba58-4281-95dd-c53d9ea98533" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=d7d81925-ba58-4281-95dd-c53d9ea98533</comments>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.sqlskills.com/blogs/bobb">Bob</a> wrote me an email as a response
      to <a href="http://www.leastprivilege.com/SystemAccountsAndSQLServer2005.aspx">this</a> post.
      He also directed me to this <a href="http://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/SQL2005SecBestPract.doc">whitepaper</a> he
      wrote about SQL Server Security. Interesting read!
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a" />
      </body>
      <title>SQL Server Security Best Practices</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a</guid>
      <link>http://www.leastprivilege.com/SQLServerSecurityBestPractices.aspx</link>
      <pubDate>Wed, 28 May 2008 08:39:37 GMT</pubDate>
      <description>&lt;p&gt;
   &lt;a href="http://www.sqlskills.com/blogs/bobb"&gt;Bob&lt;/a&gt; wrote me an email as a response
   to &lt;a href="http://www.leastprivilege.com/SystemAccountsAndSQLServer2005.aspx"&gt;this&lt;/a&gt; post.
   He also directed me to this &lt;a href="http://download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/SQL2005SecBestPract.doc"&gt;whitepaper&lt;/a&gt; he
   wrote about SQL Server Security. Interesting read!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=9c9d4ab6-c1d9-45b8-b6ef-bbb4f4f56c9a</comments>
      <category>For Your Favourites</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=fcf019b2-11fb-4c61-a58a-88efdb06056b</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=fcf019b2-11fb-4c61-a58a-88efdb06056b</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=fcf019b2-11fb-4c61-a58a-88efdb06056b</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=fcf019b2-11fb-4c61-a58a-88efdb06056b</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Funny and educational:
   </p>
        <p>
          <a title="http://idtheft.fun.de/" href="http://idtheft.fun.de/">http://idtheft.fun.de/</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=fcf019b2-11fb-4c61-a58a-88efdb06056b" />
      </body>
      <title>OpenID Phishing Demo</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=fcf019b2-11fb-4c61-a58a-88efdb06056b</guid>
      <link>http://www.leastprivilege.com/OpenIDPhishingDemo.aspx</link>
      <pubDate>Mon, 26 May 2008 20:02:32 GMT</pubDate>
      <description>&lt;p&gt;
   Funny and educational:
&lt;/p&gt;
&lt;p&gt;
   &lt;a title="http://idtheft.fun.de/" href="http://idtheft.fun.de/"&gt;http://idtheft.fun.de/&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=fcf019b2-11fb-4c61-a58a-88efdb06056b" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=fcf019b2-11fb-4c61-a58a-88efdb06056b</comments>
      <category>For Your Favourites;IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=50d609a8-e4e9-4a68-846e-fd40dfc41bf6</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=50d609a8-e4e9-4a68-846e-fd40dfc41bf6</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=50d609a8-e4e9-4a68-846e-fd40dfc41bf6</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=50d609a8-e4e9-4a68-846e-fd40dfc41bf6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I recently ran into a strange situation - I was expecting an "access denied" but it
      didn't happen (yes - security guys are strange people ;). Here's the long story:
   </p>
        <p>
      I was writing some test code for LINQ to SQL (see <a href="http://www.leastprivilege.com/LINQToSQLAndSecurity.aspx">here</a>)
      in ASP.NET. Since this was on a freshly installed box I was expecting an access denied
      since I hadn't created a SQL login for <em>Network Service</em> yet. But it worked
      - I could successfully query (and update) data in all databases. Shock.
   </p>
        <p>
      After some investigation I found the reason for this behavior. Since I was using SQL
      Express, the SQL instance was running as <em>Network Service</em> (the default). Furthermore
      setup creates a Windows group for SQL Server service accounts (e.g. MACHINE\SQLServer2005MSSQLUser$...)
      and puts <em>Network Service</em> in there. It turns out that this Windows group is
      mapped to a SQL login with a server role of <em>sysadmin...</em></p>
        <p>
      This means (on my machine) that all SQL clients running as <em>Network Service</em> (or
      can get an impersonation token for that account) have <em>sysadmin</em> privileges
      in the SQL Server installation. Or more generally - when a client can use the same
      Windows account as SQL Server itself - it will get sysadmin privileges
   </p>
        <p>
      I thought I might point this out, since running SQL Server and ASP.NET as <em>Network
      Service</em> seems to be a pretty common configuration.
   </p>
        <p>
          <strong>The moral of the story: Always create dedicated service accounts for SQL Server
      (or every service you install). </strong>
        </p>
        <p>
      btw - the full blown SQL Server installation specifically asks you for the account
      to use (but also gives <em>Network Service</em> as a choice).
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=50d609a8-e4e9-4a68-846e-fd40dfc41bf6" />
      </body>
      <title>System Accounts and SQL Server 2005</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=50d609a8-e4e9-4a68-846e-fd40dfc41bf6</guid>
      <link>http://www.leastprivilege.com/SystemAccountsAndSQLServer2005.aspx</link>
      <pubDate>Mon, 26 May 2008 11:26:37 GMT</pubDate>
      <description>&lt;p&gt;
   I recently ran into a strange situation - I was expecting an "access denied" but it
   didn't happen (yes - security guys are strange people ;). Here's the long story:
&lt;/p&gt;
&lt;p&gt;
   I was writing some test code for LINQ to SQL (see &lt;a href="http://www.leastprivilege.com/LINQToSQLAndSecurity.aspx"&gt;here&lt;/a&gt;)
   in ASP.NET. Since this was on a freshly installed box I was expecting an access denied
   since I hadn't created a SQL login for &lt;em&gt;Network Service&lt;/em&gt; yet. But it worked
   - I could successfully query (and update) data in all databases. Shock.
&lt;/p&gt;
&lt;p&gt;
   After some investigation I found the reason for this behavior. Since I was using SQL
   Express, the SQL instance was running as &lt;em&gt;Network Service&lt;/em&gt; (the default). Furthermore
   setup creates a Windows group for SQL Server service accounts (e.g. MACHINE\SQLServer2005MSSQLUser$...)
   and puts &lt;em&gt;Network Service&lt;/em&gt; in there. It turns out that this Windows group is
   mapped to a SQL login with a server role of &lt;em&gt;sysadmin...&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
   This means (on my machine) that all SQL clients running as &lt;em&gt;Network Service&lt;/em&gt; (or
   can get an impersonation token for that account) have &lt;em&gt;sysadmin&lt;/em&gt; privileges
   in the SQL Server installation. Or more generally - when a client can use the same
   Windows account as SQL Server itself - it will get sysadmin privileges
&lt;/p&gt;
&lt;p&gt;
   I thought I might point this out, since running SQL Server and ASP.NET as &lt;em&gt;Network
   Service&lt;/em&gt; seems to be a pretty common configuration.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;The moral of the story: Always create dedicated service accounts for SQL Server
   (or every service you install). &lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   btw - the full blown SQL Server installation specifically asks you for the account
   to use (but also gives &lt;em&gt;Network Service&lt;/em&gt; as a choice).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=50d609a8-e4e9-4a68-846e-fd40dfc41bf6" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=50d609a8-e4e9-4a68-846e-fd40dfc41bf6</comments>
      <category>Work in Progress</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=5ec86ca3-e719-464a-b5be-220aa31102ce</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=5ec86ca3-e719-464a-b5be-220aa31102ce</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=5ec86ca3-e719-464a-b5be-220aa31102ce</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5ec86ca3-e719-464a-b5be-220aa31102ce</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      The <em>IErrorHandler</em> interface in WCF allows to write some central error handling
      code that gets invoked whenever an unhandled exception bubbles up from your service.
      There are two methods to implement:
   </p>
        <ul>
          <li>
            <em>ProvideFault</em> - called on the request thread to turn the exception into a
         fault message</li>
          <li>
            <em>HandleError</em> - called on a separate thread for error logging and the like</li>
        </ul>
        <p>
      While WCF tries its best to shield the service host from all kinds of error conditions,
      there are some situations where unhandled exceptions can hurt your hosting process.
      One of them is the <em>HandleError</em> method on <em>IErrorHandler</em>.
   </p>
        <p>
          <em>HandleError</em> is called on a background thread to allow doing (kind of) lenghty
      operations without impacting the request where the error originally occurred. If you
      have an unhandled exception in <em>HandleError</em> the normal CLR rules for excpetions
      in background threads apply - which means shutting down the process. Be careful here.
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5ec86ca3-e719-464a-b5be-220aa31102ce" />
      </body>
      <title>Avoid unhandled Exceptions in WCF Error Handlers</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=5ec86ca3-e719-464a-b5be-220aa31102ce</guid>
      <link>http://www.leastprivilege.com/AvoidUnhandledExceptionsInWCFErrorHandlers.aspx</link>
      <pubDate>Fri, 23 May 2008 08:26:30 GMT</pubDate>
      <description>&lt;p&gt;
   The &lt;em&gt;IErrorHandler&lt;/em&gt; interface in WCF allows to write some central error handling
   code that gets invoked whenever an unhandled exception bubbles up from your service.
   There are two methods to implement:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;em&gt;ProvideFault&lt;/em&gt; - called on the request thread to turn the exception into a
      fault message&lt;/li&gt;
   &lt;li&gt;
      &lt;em&gt;HandleError&lt;/em&gt; - called on a separate thread for error logging and the like&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   While WCF tries its best to shield the service host from all kinds of error conditions,
   there are some situations where unhandled exceptions can hurt your hosting process.
   One of them is the &lt;em&gt;HandleError&lt;/em&gt; method on &lt;em&gt;IErrorHandler&lt;/em&gt;.
&lt;/p&gt;
&lt;p&gt;
   &lt;em&gt;HandleError&lt;/em&gt; is called on a background thread to allow doing (kind of) lenghty
   operations without impacting the request where the error originally occurred. If you
   have an unhandled exception in &lt;em&gt;HandleError&lt;/em&gt; the normal CLR rules for excpetions
   in background threads apply - which means shutting down the process. Be careful here.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=5ec86ca3-e719-464a-b5be-220aa31102ce" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=5ec86ca3-e719-464a-b5be-220aa31102ce</comments>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://support.microsoft.com/kb/254632">http://support.microsoft.com/kb/254632</a>
        </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7" />
      </body>
      <title>How to change validity period of issued certificates in Windows Certificate Services</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7</guid>
      <link>http://www.leastprivilege.com/HowToChangeValidityPeriodOfIssuedCertificatesInWindowsCertificateServices.aspx</link>
      <pubDate>Sun, 18 May 2008 15:22:24 GMT</pubDate>
      <description>&lt;p&gt;
   &lt;a href="http://support.microsoft.com/kb/254632"&gt;http://support.microsoft.com/kb/254632&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=da9f58c3-5442-4f68-a2c4-ea93d4c9cbc7</comments>
      <category>For Your Favourites</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=24ee543d-a836-4b35-b00d-1366cb1733a5</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=24ee543d-a836-4b35-b00d-1366cb1733a5</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=24ee543d-a836-4b35-b00d-1366cb1733a5</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=24ee543d-a836-4b35-b00d-1366cb1733a5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Shawn details the two big security changes in .NET 3.5 SP1 on his blog:
   </p>
        <ul>
          <li>
            <a href="http://blogs.msdn.com/shawnfa/archive/2008/05/14/strong-name-bypass.aspx">Strong
         Name Bypass</a>
          </li>
          <li>
            <a href="http://blogs.msdn.com/shawnfa/archive/2008/05/12/fulltrust-on-the-localintranet.aspx">Full
         Trust on the Local Intranet</a>
          </li>
        </ul>
        <p>
      We have discussed both changes internally - and I have mixed feelings about them.
      I guess the most important thing to be aware of is, that they are not opt-in changes.
      By installing SP1 - the behavior will change automatically - if you like it or not.
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=24ee543d-a836-4b35-b00d-1366cb1733a5" />
      </body>
      <title>Two important Security changes in .NET 3.5 SP1</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=24ee543d-a836-4b35-b00d-1366cb1733a5</guid>
      <link>http://www.leastprivilege.com/TwoImportantSecurityChangesInNET35SP1.aspx</link>
      <pubDate>Thu, 15 May 2008 06:53:45 GMT</pubDate>
      <description>&lt;p&gt;
   Shawn details the two big security changes in .NET 3.5 SP1 on his blog:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;a href="http://blogs.msdn.com/shawnfa/archive/2008/05/14/strong-name-bypass.aspx"&gt;Strong
      Name Bypass&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://blogs.msdn.com/shawnfa/archive/2008/05/12/fulltrust-on-the-localintranet.aspx"&gt;Full
      Trust on the Local Intranet&lt;/a&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   We have discussed both changes internally - and I have mixed feelings about them.
   I guess the most important thing to be aware of is, that they are not opt-in changes.
   By installing SP1 - the behavior will change automatically - if you like it or not.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=24ee543d-a836-4b35-b00d-1366cb1733a5" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=24ee543d-a836-4b35-b00d-1366cb1733a5</comments>
      <category>FX Security</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Thanks to <a href="http://blogs.msdn.com/carlosag/">CarlosAg</a> from the IIS team,
      I was able to improve my tool for registering IIS 7 management modules.
   </p>
        <p>
          <a href="http://www.leastprivilege.com/content/binary/IisRegMgmt01.zip">IisRegMgmt01.zip</a>
        </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc" />
      </body>
      <title>Improved IisRegMgmt</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc</guid>
      <link>http://www.leastprivilege.com/ImprovedIisRegMgmt.aspx</link>
      <pubDate>Wed, 14 May 2008 06:34:10 GMT</pubDate>
      <description>&lt;p&gt;
   Thanks to &lt;a href="http://blogs.msdn.com/carlosag/"&gt;CarlosAg&lt;/a&gt; from the IIS team,
   I was able to improve my tool for registering IIS 7 management modules.
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.leastprivilege.com/content/binary/IisRegMgmt01.zip"&gt;IisRegMgmt01.zip&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=2f7d30da-b7b1-4d28-9b89-6bef02ad15cc</comments>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=6e1dbade-12c5-44f7-98c4-6b90d4cd9963</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=6e1dbade-12c5-44f7-98c4-6b90d4cd9963</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=6e1dbade-12c5-44f7-98c4-6b90d4cd9963</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6e1dbade-12c5-44f7-98c4-6b90d4cd9963</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      To play around with peer name registration and resolution, I wrote a little tool that
      makes this easy (yes - I know all this functionality is also available via netsh -
      but I wanted something more specialized).
   </p>
        <p>
          <strong>Registering</strong>
        </p>
        <p>
          <img src="http://www.leastprivilege.com/content/binary/PeerNameReg.png" border="0" />
        </p>
        <p>
          <strong>Resolving</strong>
        </p>
        <p>
          <img src="http://www.leastprivilege.com/content/binary/PeerNameResolve.png" border="0" />
        </p>
        <p>
          <a href="http://www.leastprivilege.com/content/binary/PeerName.zip">PeerName.zip (27.31
      KB)</a>
        </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=6e1dbade-12c5-44f7-98c4-6b90d4cd9963" />
      </body>
      <title>P2P and WCF: The PeerName Tool</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=6e1dbade-12c5-44f7-98c4-6b90d4cd9963</guid>
      <link>http://www.leastprivilege.com/P2PAndWCFThePeerNameTool.aspx</link>
      <pubDate>Wed, 14 May 2008 06:03:31 GMT</pubDate>
      <description>&lt;p&gt;
   To play around with peer name registration and resolution, I wrote a little tool that
   makes this easy (yes - I know all this functionality is also available via netsh -
   but I wanted something more specialized).
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Registering&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.leastprivilege.com/content/binary/PeerNameReg.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;Resolving&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.leastprivilege.com/content/binary/PeerNameResolve.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.leastprivilege.com/content/binary/PeerName.zip"&gt;PeerName.zip (27.31
   KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=6e1dbade-12c5-44f7-98c4-6b90d4cd9963" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=6e1dbade-12c5-44f7-98c4-6b90d4cd9963</comments>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=85567584-e6c1-4a35-86fb-78a447e27a77</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=85567584-e6c1-4a35-86fb-78a447e27a77</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=85567584-e6c1-4a35-86fb-78a447e27a77</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=85567584-e6c1-4a35-86fb-78a447e27a77</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      While reading through some of the code of <em>System.IdentityModel</em>, I noticed
      that there is some diagnostics tracing going on. Just add a trace listener for the
      source 'System.IdentityModel' to your config file.
   </p>
        <p>
      HTH
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=85567584-e6c1-4a35-86fb-78a447e27a77" />
      </body>
      <title>Using IdentityModel: Tracing</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=85567584-e6c1-4a35-86fb-78a447e27a77</guid>
      <link>http://www.leastprivilege.com/UsingIdentityModelTracing.aspx</link>
      <pubDate>Mon, 12 May 2008 17:28:09 GMT</pubDate>
      <description>&lt;p&gt;
   While reading through some of the code of &lt;em&gt;System.IdentityModel&lt;/em&gt;, I noticed
   that there is some diagnostics tracing going on. Just add a trace listener for the
   source 'System.IdentityModel' to your config file.
&lt;/p&gt;
&lt;p&gt;
   HTH
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=85567584-e6c1-4a35-86fb-78a447e27a77" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=85567584-e6c1-4a35-86fb-78a447e27a77</comments>
      <category>IdentityModel;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=a38f39cb-900c-4bf7-9cb6-5cb17639ad53</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=a38f39cb-900c-4bf7-9cb6-5cb17639ad53</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=a38f39cb-900c-4bf7-9cb6-5cb17639ad53</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a38f39cb-900c-4bf7-9cb6-5cb17639ad53</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      If you want to know more about P2P and its related protocols and components, here's
      a list of online resource I found useful while researching:
   </p>
        <ul>
          <li>
            <a href="http://blogs.msdn.com/p2p/">P2P team blog</a>
          </li>
          <li>
            <a href="http://blogs.msdn.com/peerchan/">Peer Channel blog</a>
          </li>
          <li>
            <a href="http://msdn.microsoft.com/en-us/library/cc219453.aspx">Peer Channel protocol
         specification</a>
          </li>
          <li>
            <a href="http://technet.microsoft.com/en-us/network/bb545868.aspx">P2P on TechNet</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/technet/network/ipv6/teredo.mspx">Teredo</a>
          </li>
          <li>
         "The Teredo Protocol: Tunneling Past Network Security and other Security Implications" <a href="http://www.symantec.com/avcenter/reference/Teredo_Security.pdf">whitepaper</a></li>
          <li>
         "Get Connected with .NET 3.5" MSDN <a href="http://msdn.microsoft.com/msdnmag/issues/07/09/Networking/default.aspx">article</a></li>
          <li>
         "Peer-to-Peer Programming with WCF and .NET Framework 3.5" MSDN <a href="http://msdn.microsoft.com/en-us/library/cc297274.aspx">article</a></li>
        </ul>
        <p>
      Have fun!
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a38f39cb-900c-4bf7-9cb6-5cb17639ad53" />
      </body>
      <title>P2P and WCF: Some Resources</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=a38f39cb-900c-4bf7-9cb6-5cb17639ad53</guid>
      <link>http://www.leastprivilege.com/P2PAndWCFSomeResources.aspx</link>
      <pubDate>Fri, 02 May 2008 04:09:01 GMT</pubDate>
      <description>&lt;p&gt;
   If you want to know more about P2P and its related protocols and components, here's
   a list of online resource I found useful while researching:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      &lt;a href="http://blogs.msdn.com/p2p/"&gt;P2P team blog&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://blogs.msdn.com/peerchan/"&gt;Peer Channel blog&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://msdn.microsoft.com/en-us/library/cc219453.aspx"&gt;Peer Channel protocol
      specification&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://technet.microsoft.com/en-us/network/bb545868.aspx"&gt;P2P on TechNet&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      &lt;a href="http://www.microsoft.com/technet/network/ipv6/teredo.mspx"&gt;Teredo&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      "The Teredo Protocol: Tunneling Past Network Security and other Security Implications" &lt;a href="http://www.symantec.com/avcenter/reference/Teredo_Security.pdf"&gt;whitepaper&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      "Get Connected with .NET 3.5" MSDN &lt;a href="http://msdn.microsoft.com/msdnmag/issues/07/09/Networking/default.aspx"&gt;article&lt;/a&gt;
   &lt;/li&gt;
   &lt;li&gt;
      "Peer-to-Peer Programming with WCF and .NET Framework 3.5" MSDN &lt;a href="http://msdn.microsoft.com/en-us/library/cc297274.aspx"&gt;article&lt;/a&gt;
   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   Have fun!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a38f39cb-900c-4bf7-9cb6-5cb17639ad53" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=a38f39cb-900c-4bf7-9cb6-5cb17639ad53</comments>
      <category>For Your Favourites;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=98a3b225-8111-4650-ba32-ae97ef0ac435</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=98a3b225-8111-4650-ba32-ae97ef0ac435</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=98a3b225-8111-4650-ba32-ae97ef0ac435</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=98a3b225-8111-4650-ba32-ae97ef0ac435</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      The <a href="http://www.leastprivilege.com/P2PAndWCFFindingAService.aspx">last</a> post
      explained how to find a PNRP registered service. What else do you have to do for e.g.
      exposing a WCF service over the P2P infrastructure?
   </p>
        <p>
      Code-wise nothing. If the WCF service listens on all NICs (the default), a client
      can do a resolution via the peer DNS name and connect to it. Easy.
   </p>
        <p>
      Well - hold on - does that mean that arbitrary clients can now traverse my NAT and
      connect to my intranet machine? Kind of - yes...
   </p>
        <p>
      For the service to be accessible you also have to adjust firewall rules:
   </p>
        <ul>
          <li>
         the port the service is listening on must be openend (this will allow <em>normal</em> TCP/IP
         traffic to the endpoint) 
      </li>
          <li>
         to allow Teredo traffic to the service, additionally the "allow edge traversal" option
         must be checked. This option is only available via the advanced firewall (available
         via <em>Administrative Tools</em> or <em>MMC</em>). See screenshot:</li>
        </ul>
        <p>
          <img src="http://www.leastprivilege.com/content/binary/EdgeTraversal_Firewall.png" border="0" />
        </p>
        <p>
      So to recap - these are the prereqs for a globally reachable service:
   </p>
        <ul>
          <li>
         P2P (PNRP and Teredo) must work properly 
      </li>
          <li>
         the service must be registered 
      </li>
          <li>
         the client (or peer) must know the peer name 
      </li>
          <li>
         the endpoint port must be opened in the firewall 
      </li>
          <li>
         Teredo traffic must be allowed for this port</li>
        </ul>
        <p>
      But one thing is very true, you now allow (internet) inbound traffic to an intranet
      hosted service, which has some implications:
   </p>
        <ul>
          <li>
         there is probably no security around that intranet machine (like a DMZ). 
      </li>
          <li>
         intranet machines are typically not hardened for exposing internet services. 
      </li>
          <li>
         this means that if the service has some security problem (e.g. directory traversal
         etc), there are no safe-nets that will stop an attacker e.g. accessing other machines
         or system resources. 
      </li>
          <li>
         your administrators may not like this!</li>
        </ul>
        <p>
      Typical P2P scenarios don't necessarily involve publicly known peer names, so you
      maybe only have a limited exposure. But still - the traffic bypasses perimeter security
      and goes directly into the intranet. So be careful.
   </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=98a3b225-8111-4650-ba32-ae97ef0ac435" />
      </body>
      <title>P2P and WCF: Exposing a Service</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=98a3b225-8111-4650-ba32-ae97ef0ac435</guid>
      <link>http://www.leastprivilege.com/P2PAndWCFExposingAService.aspx</link>
      <pubDate>Thu, 01 May 2008 09:26:52 GMT</pubDate>
      <description>&lt;p&gt;
   The &lt;a href="http://www.leastprivilege.com/P2PAndWCFFindingAService.aspx"&gt;last&lt;/a&gt; post
   explained how to find a PNRP registered service. What else do you have to do for e.g.
   exposing a WCF service over the P2P infrastructure?
&lt;/p&gt;
&lt;p&gt;
   Code-wise nothing. If the WCF service listens on all NICs (the default), a client
   can do a resolution via the peer DNS name and connect to it. Easy.
&lt;/p&gt;
&lt;p&gt;
   Well - hold on - does that mean that arbitrary clients can now traverse my NAT and
   connect to my intranet machine? Kind of - yes...
&lt;/p&gt;
&lt;p&gt;
   For the service to be accessible you also have to adjust firewall rules:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      the port the service is listening on must be openend (this will allow &lt;em&gt;normal&lt;/em&gt; TCP/IP
      traffic to the endpoint) 
   &lt;li&gt;
      to allow Teredo traffic to the service, additionally the "allow edge traversal" option
      must be checked. This option is only available via the advanced firewall (available
      via &lt;em&gt;Administrative Tools&lt;/em&gt; or &lt;em&gt;MMC&lt;/em&gt;). See screenshot:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   &lt;img src="http://www.leastprivilege.com/content/binary/EdgeTraversal_Firewall.png" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
   So to recap - these are the prereqs for a globally reachable service:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      P2P (PNRP and Teredo) must work properly 
   &lt;li&gt;
      the service must be registered 
   &lt;li&gt;
      the client (or peer) must know the peer name 
   &lt;li&gt;
      the endpoint port must be opened in the firewall 
   &lt;li&gt;
      Teredo traffic must be allowed for this port&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   But one thing is very true, you now allow (internet) inbound traffic to an intranet
   hosted service, which has some implications:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      there is probably no security around that intranet machine (like a DMZ). 
   &lt;li&gt;
      intranet machines are typically not hardened for exposing internet services. 
   &lt;li&gt;
      this means that if the service has some security problem (e.g. directory traversal
      etc), there are no safe-nets that will stop an attacker e.g. accessing other machines
      or system resources. 
   &lt;li&gt;
      your administrators may not like this!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   Typical P2P scenarios don't necessarily involve publicly known peer names, so you
   maybe only have a limited exposure. But still - the traffic bypasses perimeter security
   and goes directly into the intranet. So be careful.
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=98a3b225-8111-4650-ba32-ae97ef0ac435" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=98a3b225-8111-4650-ba32-ae97ef0ac435</comments>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=d5154265-efff-4252-84a1-e67658abeb87</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=d5154265-efff-4252-84a1-e67658abeb87</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=d5154265-efff-4252-84a1-e67658abeb87</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d5154265-efff-4252-84a1-e67658abeb87</wfw:commentRss>
      <title>P2P and WCF: Finding a Service</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=d5154265-efff-4252-84a1-e67658abeb87</guid>
      <link>http://www.leastprivilege.com/P2PAndWCFFindingAService.aspx</link>
      <pubDate>Thu, 01 May 2008 06:43:10 GMT</pubDate>
      <description>&lt;p&gt;
   After you have &lt;a href="http://www.leastprivilege.com/P2PAndWCFRegisteringAService.aspx"&gt;registered&lt;/a&gt; a
   service, the next step is to find it again. The &lt;em&gt;System.Net.PeerToPeer&lt;/em&gt; API
   includes a &lt;em&gt;PeerNameResolver&lt;/em&gt; class which does that.
&lt;/p&gt;
&lt;p&gt;
   You input the peer name and get back the registration details (IP addresses, port,
   comment and data):
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;static&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Resolve(&lt;span style="color: blue"&gt;string&lt;/span&gt; name)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PeerNameResolver&lt;/span&gt; resolver
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PeerNameResolver&lt;/span&gt;();&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PeerName&lt;/span&gt; peerName
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PeerName&lt;/span&gt;(name);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Resolving
   {0}..."&lt;/span&gt;, peerName);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PeerNameRecordCollection&lt;/span&gt; results
   = resolver.Resolve(peerName);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (results.Count
   == 0)&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"No
   records found."&lt;/span&gt;);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt;;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;int&lt;/span&gt; count
   = 1;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;PeerNameRecord&lt;/span&gt; record &lt;span style="color: blue"&gt;in&lt;/span&gt; results)&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Record
   #{0}\n"&lt;/span&gt;, count);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"DNS
   Name: {0}"&lt;/span&gt;, record.PeerName.PeerHostName);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"Endpoints:"&lt;/span&gt;);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;IPEndPoint&lt;/span&gt; endpoint &lt;span style="color: blue"&gt;in&lt;/span&gt; record.EndPointCollection)&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515"&gt;"\t
   Endpoint:{0}"&lt;/span&gt;, endpoint);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;count++;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   The way you will resolve peer names more commonly is via the DNS format (the &lt;em&gt;PeerHostName&lt;/em&gt; property
   in the above code). A peer name also has DNS name representation (e.g. &lt;em&gt;foo.pnrp.net&lt;/em&gt; for
   an unsecured service named &lt;em&gt;foo&lt;/em&gt;). Whenever you use this format (e.g. with
   ping or any other application that does DNS name resolution), Windows will use the
   P2P APIs internally to return the corresponding IP address). See &lt;a href="http://blogs.msdn.com/p2p/archive/2007/06/15/pnrp-and-pnrp-net.aspx"&gt;here&lt;/a&gt; for
   the details.
&lt;/p&gt;
&lt;p&gt;
   This e.g. means that you could make a registration on a web server for port 80 and
   can use the browser to directly connect to the web server using the DNS format name.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=d5154265-efff-4252-84a1-e67658abeb87" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=d5154265-efff-4252-84a1-e67658abeb87</comments>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=69ceff74-e10a-4bfe-b1b4-87a76af1e738</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=69ceff74-e10a-4bfe-b1b4-87a76af1e738</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=69ceff74-e10a-4bfe-b1b4-87a76af1e738</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=69ceff74-e10a-4bfe-b1b4-87a76af1e738</wfw:commentRss>
      <title>P2P and WCF: Registering a Service</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=69ceff74-e10a-4bfe-b1b4-87a76af1e738</guid>
      <link>http://www.leastprivilege.com/P2PAndWCFRegisteringAService.aspx</link>
      <pubDate>Thu, 01 May 2008 05:42:58 GMT</pubDate>
      <description>&lt;p&gt;
   To make a service discoverable using the P2P infrastructure, you first have to do
   a so called peer name registration.
&lt;/p&gt;
&lt;p&gt;
   A peer name registration has the following properties:
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      a name (there are two different flavours: secured and unsecured - more on that later) 
   &lt;li&gt;
      one or more IP addresses and scope 
   &lt;li&gt;
      a port number 
   &lt;li&gt;
      a comment (optional) 
   &lt;li&gt;
      up to 4KB of binary data (optional)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   &lt;strong&gt;Peer Name&lt;/strong&gt;
   &lt;br&gt;
   The name of the service you want to register. Names have the following format: 'authorityId.Name'.
   Unsecured Names use a '0' as the authorityId and are easy to spoof/squat. When using
   a secured name, a key/pair is generated on the fly (the first time only) to sign the
   registration request. The public key hash becomes the authorityId in this case.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;IP addresses and scope&lt;/strong&gt;
   &lt;br&gt;
   That's the most fascinating (and complicated) part. The peer name registration can
   have local and/or a global scope. A global scope means that the service can be discovered
   and contacted - well - globally. How can that work, given the service is behind a
   NAT device? IPv6 is the answer.
&lt;/p&gt;
&lt;p&gt;
   Now you may ask yourself: "but my network/router hardware is not IPv6 enabled, can
   this still work?". Yes it does - making the transition between IPv4 and IPv6 is the
   job of so called transition or tunneling protocols. Teredo is the name of the protocol
   that is typically used here. Teredo has several jobs - one is to provide a globally
   unique IPv6 address, the other is to enable NAT traversal. I won't go into the Teredo
   details here, but this &lt;a href="http://technet.microsoft.com/en-us/library/bb457011.aspx"&gt;document&lt;/a&gt; describes
   how it works.
&lt;/p&gt;
&lt;p&gt;
   When you do a &lt;em&gt;'ipconfig'&lt;/em&gt; on the command line you may already see a bunch
   of IPv6 addresses. The one that is directly associated with your NIC is the local
   address. You may also see a "Tunnel Adapter" interface - that would be the global
   Teredo provided address.
&lt;/p&gt;
&lt;p&gt;
   You can check the status/health of the Teredo protocol by using this command: &lt;em&gt;'netsh
   int teredo show state'&lt;/em&gt;. This &lt;a href="http://blogs.msdn.com/p2p/archive/2007/03/22/teredo-and-the-pnrp-global-cloud.aspx"&gt;article&lt;/a&gt; helps
   you with troubleshooting if Teredo should not be enabled on your machine.
&lt;/p&gt;
&lt;p&gt;
   You can also have a look at the scope of your registration by checking the &lt;em&gt;clouds&lt;/em&gt; to
   which your machine has access. This is done by doing a &lt;em&gt;'netsh p2p pnrp cloud show
   list'&lt;/em&gt;. You should see one or more &lt;em&gt;LinkLocal_&lt;/em&gt; clouds and a &lt;em&gt;Global_&lt;/em&gt; cloud.
&lt;/p&gt;
&lt;p&gt;
   Again this &lt;a href="http://blogs.msdn.com/p2p/archive/2007/06/12/understanding-pnrp-clouds.aspx"&gt;article&lt;/a&gt; has
   all the details on clouds and their background.
&lt;/p&gt;
&lt;p&gt;
   So to wrap it up - by default a peer name registration will use all available NICs/IP
   addresses. If you have a global IPv6 address (which means that Teredo is working properly
   and you can 'see' the global cloud) this one is used also. This in turn means that
   the service can be used by every client that also has a global address.
&lt;/p&gt;
&lt;p&gt;
   The remaining properties are self explaining I think.
&lt;/p&gt;
&lt;p&gt;
   The following code snippet would register a secured peer name in all available clouds
   (you can find the APIs in the System.Net assembly (v3.5):
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;private&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Register(&lt;span style="color: blue"&gt;string&lt;/span&gt; name, &lt;span style="color: blue"&gt;int&lt;/span&gt; port, &lt;span style="color: blue"&gt;string&lt;/span&gt; comment)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PeerName&lt;/span&gt; peerName
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PeerName&lt;/span&gt;(name, &lt;span style="color: #2b91af"&gt;PeerNameType&lt;/span&gt;.Secured);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PeerNameRegistration&lt;/span&gt; reg
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PeerNameRegistration&lt;/span&gt;();&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;reg.PeerName = peerName;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;reg.Port = port;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;reg.Cloud = &lt;span style="color: #2b91af"&gt;Cloud&lt;/span&gt;.Available;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;reg.Comment = _cl.Comment;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;reg.Start();&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   The next posts will deal with peer name resolution and how to host a WCF service over
   this infrastructure.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=69ceff74-e10a-4bfe-b1b4-87a76af1e738" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=69ceff74-e10a-4bfe-b1b4-87a76af1e738</comments>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=2b264cfe-9822-4054-aa51-37e27524f81b</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=2b264cfe-9822-4054-aa51-37e27524f81b</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=2b264cfe-9822-4054-aa51-37e27524f81b</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=2b264cfe-9822-4054-aa51-37e27524f81b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Since I started playing around with computers, communication of machines over a "wire"
      has been fascinating to me. This is probably why I ended up in the distributed applications
      space.
   </p>
        <p>
      Typically clients talk to servers and servers to servers - but less common clients
      directly to clients. But applications like MSN Messenger or Skype show useful use
      cases of client to client communication. With Vista and Server 2008 (and XP SP2 +
      some components) peer to peer networking has become part of the operating system.
      There is also a peer channel in WCF that sits on top of these core components. Time
      to have a closer look.
   </p>
        <p>
      So what features is the P2P infrastructure supposed to give you?
   </p>
        <ul>
          <li>
         Global/local registration of services</li>
          <li>
         Global/local connectivity between peers which includes the capability to traverse
         NAT devices</li>
          <li>
         Global/local virtual broadcasting networks</li>
          <li>
         Peer/Service Discovery</li>
          <li>
         Invitation/activation of P2P enabled applications</li>
        </ul>
        <p>
      All of these capabilities are as fascinating as they are scary. More importantly I
      really think that P2P communication patterns will be a "big" thing and will also change
      the way we have to think about network/perimeter security.
   </p>
        <p>
      In the next posts I will write about some of my findings. Stay tuned.
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=2b264cfe-9822-4054-aa51-37e27524f81b" />
      </body>
      <title>P2P, PNRP, Teredo...the Motivation</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=2b264cfe-9822-4054-aa51-37e27524f81b</guid>
      <link>http://www.leastprivilege.com/P2PPNRPTeredotheMotivation.aspx</link>
      <pubDate>Wed, 30 Apr 2008 06:18:56 GMT</pubDate>
      <description>&lt;p&gt;
   Since I started playing around with computers, communication of machines over a "wire"
   has been fascinating to me. This is probably why I ended up in the distributed applications
   space.
&lt;/p&gt;
&lt;p&gt;
   Typically clients talk to servers and servers to servers - but less common clients
   directly to clients. But applications like MSN Messenger or Skype show useful use
   cases of client to client communication. With Vista and Server 2008 (and XP SP2 +
   some components) peer to peer networking has become part of the operating system.
   There is also a peer channel in WCF that sits on top of these core components. Time
   to have a closer look.
&lt;/p&gt;
&lt;p&gt;
   So what features is the P2P infrastructure supposed to give you?
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      Global/local registration of services&lt;/li&gt;
   &lt;li&gt;
      Global/local connectivity between peers which includes the capability to traverse
      NAT devices&lt;/li&gt;
   &lt;li&gt;
      Global/local virtual broadcasting networks&lt;/li&gt;
   &lt;li&gt;
      Peer/Service Discovery&lt;/li&gt;
   &lt;li&gt;
      Invitation/activation of P2P enabled applications&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
   All of these capabilities are as fascinating as they are scary. More importantly I
   really think that P2P communication patterns will be a "big" thing and will also change
   the way we have to think about network/perimeter security.
&lt;/p&gt;
&lt;p&gt;
   In the next posts I will write about some of my findings. Stay tuned.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=2b264cfe-9822-4054-aa51-37e27524f81b" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=2b264cfe-9822-4054-aa51-37e27524f81b</comments>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=54620546-a29b-479f-af68-c530aabcf70f</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=54620546-a29b-479f-af68-c530aabcf70f</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=54620546-a29b-479f-af68-c530aabcf70f</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=54620546-a29b-479f-af68-c530aabcf70f</wfw:commentRss>
      <title>Using IdentityModel: Converting ADFS Security Properties to Claims</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=54620546-a29b-479f-af68-c530aabcf70f</guid>
      <link>http://www.leastprivilege.com/UsingIdentityModelConvertingADFSSecurityPropertiesToClaims.aspx</link>
      <pubDate>Mon, 28 Apr 2008 05:39:21 GMT</pubDate>
      <description>&lt;p&gt;
   This little helper might be useful when you are working with ADFS, but want to use
   the IdentityModel types in your app:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt; ToClaimSet(&lt;span style="color: blue"&gt;this&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SingleSignOnIdentity&lt;/span&gt; identity)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;
   claims = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;&amp;gt;();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;claims.Add(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(identity.NameType,
   identity.Name, &lt;span style="color: #2b91af"&gt;Rights&lt;/span&gt;.Identity));&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;foreach&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;SecurityProperty&lt;/span&gt; property &lt;span style="color: blue"&gt;in&lt;/span&gt; identity.SecurityPropertyCollection)&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt; claimType
   = property.Uri;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (claimType.EndsWith(&lt;span style="color: #a31515"&gt;"NameValue"&lt;/span&gt;))&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;claimType
   = property.Name;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;claims.Add(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Claim&lt;/span&gt;(claimType,
   property.Value, &lt;span style="color: #2b91af"&gt;Rights&lt;/span&gt;.PossessProperty));&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;return&lt;/span&gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DefaultClaimSet&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ClaimSet&lt;/span&gt;.System,
   claims);&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=54620546-a29b-479f-af68-c530aabcf70f" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=54620546-a29b-479f-af68-c530aabcf70f</comments>
      <category>IdentityModel</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=f920f63b-8f39-44ed-aac3-c994f1604a12</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=f920f63b-8f39-44ed-aac3-c994f1604a12</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=f920f63b-8f39-44ed-aac3-c994f1604a12</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f920f63b-8f39-44ed-aac3-c994f1604a12</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Gesehen auf der JAX2008 Webseite:
   </p>
        <blockquote>
          <p>
            <strong>Security Last – Sicherheitsentscheidungen spät treffen</strong>
            <br />
      Sicherheitsanforderungen wie Logins und Berechtigung sind wichtig – aber müssen diese
      wirklich gleich am Anfang umgesetzt werden? Das nachträgliche Hinzufügen dieser Anforderungen
      mit reinem Java und OOP ist sehr schwierig, weshalb dies meistens mit „Ja“ beantwortet
      wird. Erfahren Sie hier, wie mithilfe von Tools wie Spring Security, AspectJ und CAS
      auch spät in Anwendungen integriert werden kann.
   </p>
        </blockquote>
        <p>
      Ohne Worte... 
   </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f920f63b-8f39-44ed-aac3-c994f1604a12" />
      </body>
      <title>Ein Session Abstract ganz genau nach meinem Geschmack</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=f920f63b-8f39-44ed-aac3-c994f1604a12</guid>
      <link>http://www.leastprivilege.com/EinSessionAbstractGanzGenauNachMeinemGeschmack.aspx</link>
      <pubDate>Tue, 22 Apr 2008 11:49:20 GMT</pubDate>
      <description>&lt;p&gt;
   Gesehen auf der JAX2008 Webseite:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
   &lt;strong&gt;Security Last – Sicherheitsentscheidungen spät treffen&lt;/strong&gt;
   &lt;br&gt;
   Sicherheitsanforderungen wie Logins und Berechtigung sind wichtig – aber müssen diese
   wirklich gleich am Anfang umgesetzt werden? Das nachträgliche Hinzufügen dieser Anforderungen
   mit reinem Java und OOP ist sehr schwierig, weshalb dies meistens mit „Ja“ beantwortet
   wird. Erfahren Sie hier, wie mithilfe von Tools wie Spring Security, AspectJ und CAS
   auch spät in Anwendungen integriert werden kann.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
   Ohne Worte... 
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f920f63b-8f39-44ed-aac3-c994f1604a12" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=f920f63b-8f39-44ed-aac3-c994f1604a12</comments>
      <category>Microsoft Deutschland Security Portal</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=a00be432-76a0-4078-b890-2143af32a68f</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=a00be432-76a0-4078-b890-2143af32a68f</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=a00be432-76a0-4078-b890-2143af32a68f</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a00be432-76a0-4078-b890-2143af32a68f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      Interesting...and shocking.
   </p>
        <p>
      Read more here: 
      <br /><a href="http://www.argeniss.com/research/TokenKidnapping.pdf">http://www.argeniss.com/research/TokenKidnapping.pdf</a></p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a00be432-76a0-4078-b890-2143af32a68f" />
      </body>
      <title>Token Kidnapping</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=a00be432-76a0-4078-b890-2143af32a68f</guid>
      <link>http://www.leastprivilege.com/TokenKidnapping.aspx</link>
      <pubDate>Sun, 20 Apr 2008 07:15:28 GMT</pubDate>
      <description>&lt;p&gt;
   Interesting...and shocking.
&lt;/p&gt;
&lt;p&gt;
   Read more here: 
   &lt;br&gt;
   &lt;a href="http://www.argeniss.com/research/TokenKidnapping.pdf"&gt;http://www.argeniss.com/research/TokenKidnapping.pdf&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=a00be432-76a0-4078-b890-2143af32a68f" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=a00be432-76a0-4078-b890-2143af32a68f</comments>
      <category>For Your Favourites</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=e14c9126-4dcb-42c7-9bac-7855c2b3f81b</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=e14c9126-4dcb-42c7-9bac-7855c2b3f81b</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=e14c9126-4dcb-42c7-9bac-7855c2b3f81b</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e14c9126-4dcb-42c7-9bac-7855c2b3f81b</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Installing an IIS 7 Extension</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=e14c9126-4dcb-42c7-9bac-7855c2b3f81b</guid>
      <link>http://www.leastprivilege.com/InstallingAnIIS7Extension.aspx</link>
      <pubDate>Sun, 20 Apr 2008 06:50:57 GMT</pubDate>
      <description>&lt;p&gt;
   Related to cleaning up my authentication module for &lt;a href="http://www.codeplex.com/CustomBasicAuth"&gt;Codeplex&lt;/a&gt;,
   I needed a way to (semi) automatically install a complete IIS extension (including
   schema, config sections and management extensions). I came up with a batch file that
   does the necessary steps (anybody out there that wants to write a real installer?).
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;1. Register all assemblies in the GAC&lt;br&gt;
   &lt;/strong&gt;Usually an IIS 7 extension consists of at least three assemblies (module/handler,
   server extensions, client extensions). Gacutil.exe is your friend here (use the /if
   option). Also take into account, that IIS loads GACed assemblies domain neutral. That
   means that you have to recycle the worker process when you update e.g. your GACed
   module.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;2. Register schema and config section&lt;/strong&gt;
   &lt;br&gt;
   This involves copying your schema to the IIS' schema directory and add a &amp;lt;configSection&amp;gt;
   registration to applicationHost.config. &lt;a href="http://mvolo.com/blogs/serverside"&gt;Mike
   Volodarsky&lt;/a&gt; from the IIS team has written a nice tool call &lt;a href="http://mvolo.com/blogs/serverside/archive/2007/08/04/IISSCHEMA.EXE-_2D00_-A-tool-to-register-IIS7-configuration-sections.aspx"&gt;IisSchema&lt;/a&gt; that
   automates this step.
&lt;/p&gt;
&lt;p&gt;
   &lt;strong&gt;3. Registering the management extension&lt;/strong&gt;
   &lt;br&gt;
   This involves adding the module to administration.config (in two different places).
   I haven't found an automated way of doing this, so I wrote a little tool to accomplish
   this task.
&lt;/p&gt;
&lt;p&gt;
   IisRegMgmt [install/uninstall] [assembly_to_register]
&lt;/p&gt;
&lt;p&gt;
   This will find all &lt;em&gt;Microsoft.Web.Management.Server.ConfigurationModuleProvider&lt;/em&gt; derived
   classes in the specified assembly and register them in administration.config.
&lt;/p&gt;
&lt;p&gt;
   The code to do the registration is as follows:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;private&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; RegisterAdministration(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; name, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; type, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; assembly)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   get access to administration.config&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Configuration&lt;/span&gt; administration
   = _manager.GetAdministrationConfiguration();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   get access to &amp;lt;moduleProviders&amp;gt;&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ConfigurationSection&lt;/span&gt; moduleProvidersSection
   = 
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;administration.GetSection(&lt;span style="COLOR: #a31515"&gt;"moduleProviders"&lt;/span&gt;);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ConfigurationElementCollection&lt;/span&gt; moduleProviders
   =&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;moduleProvidersSection.GetCollection();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   check for existing elements first&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Clean(name, moduleProviders);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   create new element&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ConfigurationElement&lt;/span&gt; newModuleProvider
   =&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;moduleProviders.CreateElement();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   set attributes&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;newModuleProvider.SetAttributeValue(&lt;span style="COLOR: #a31515"&gt;"name"&lt;/span&gt;,
   name);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;newModuleProvider.SetAttributeValue(&lt;span style="COLOR: #a31515"&gt;"type"&lt;/span&gt;,
   type + &lt;span style="COLOR: #a31515"&gt;", "&lt;/span&gt; + assembly);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   add element&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;moduleProviders.Add(newModuleProvider);&lt;br&gt;
   &lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   get access to &amp;lt;modules&amp;gt;&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ConfigurationSection&lt;/span&gt; modulesSection
   = 
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;administration.GetSection(&lt;span style="COLOR: #a31515"&gt;"modules"&lt;/span&gt;);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ConfigurationElementCollection&lt;/span&gt; modules
   = modulesSection.GetCollection();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   check for existing element first&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Clean(name, modules);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   create new element&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;ConfigurationElement&lt;/span&gt; newModule
   = modules.CreateElement();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   set attributes&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;newModule.SetAttributeValue(&lt;span style="COLOR: #a31515"&gt;"name"&lt;/span&gt;,
   name);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   add element&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;modules.Add(newModule);&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: green"&gt;//
   save changes&lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_manager.CommitChanges();&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   Don't forget to clean up the sections before you add the new module, otherwise you
   might end up with double entries:
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;private&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Clean(&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; name, &lt;span style="COLOR: #2b91af"&gt;ConfigurationElementCollection&lt;/span&gt; elements)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; hits
   = &lt;span style="COLOR: blue"&gt;from&lt;/span&gt; e &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; elements&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;where&lt;/span&gt; (&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;)e.GetAttributeValue(&lt;span style="COLOR: #a31515"&gt;"name"&lt;/span&gt;)
   == name&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;select&lt;/span&gt; e;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;hits.ToList().ForEach(e
   =&amp;gt; elements.Remove(e));&lt;br&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   For completeness sake, here's how you can find the right management classes in the
   assembly (and because I was amused about 'Linq to Reflection' ;)
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN-BOTTOM: 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="COLOR: blue; FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;private&lt;/span&gt;&lt;span style="FONT-FAMILY: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;gt;
   GetManagementTypes(&lt;span style="COLOR: #2b91af"&gt;Assembly&lt;/span&gt; a)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; baseType
   = &lt;span style="COLOR: #a31515"&gt;"Microsoft.Web.Management.Server.ConfigurationModuleProvider"&lt;/span&gt;;&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;var&lt;/span&gt; types
   = &lt;span style="COLOR: blue"&gt;from&lt;/span&gt; t &lt;span style="COLOR: blue"&gt;in&lt;/span&gt; a.GetExportedTypes()&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;where&lt;/span&gt; t.BaseType.FullName
   == baseType&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;select&lt;/span&gt; t.FullName;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; types;&lt;br&gt;
   }&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.leastprivilege.com/content/binary/IisRegMgmt01.zip"&gt;IisRegMgmt01.zip
   (18.66 KB)&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=e14c9126-4dcb-42c7-9bac-7855c2b3f81b" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=e14c9126-4dcb-42c7-9bac-7855c2b3f81b</comments>
      <category>IIS</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=f9453fb0-6e2a-4faf-8cf9-62162dc7531e</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=f9453fb0-6e2a-4faf-8cf9-62162dc7531e</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=f9453fb0-6e2a-4faf-8cf9-62162dc7531e</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=f9453fb0-6e2a-4faf-8cf9-62162dc7531e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I also moved my "Basic Authentication against non-Windows accounts for IIS" (phew)
      project to Codeplex
   </p>
        <p>
          <a href="http://www.codeplex.com/CustomBasicAuth">http://www.codeplex.com/CustomBasicAuth</a>
        </p>
        <p>
      Again, if you have feature ideas or want to contribute, contact me.
   </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f9453fb0-6e2a-4faf-8cf9-62162dc7531e" />
      </body>
      <title>Custom Basic Authentication is now on Codeplex</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=f9453fb0-6e2a-4faf-8cf9-62162dc7531e</guid>
      <link>http://www.leastprivilege.com/CustomBasicAuthenticationIsNowOnCodeplex.aspx</link>
      <pubDate>Sat, 19 Apr 2008 07:44:05 GMT</pubDate>
      <description>&lt;p&gt;
   I also moved my "Basic Authentication against non-Windows accounts for IIS" (phew)
   project to Codeplex
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.codeplex.com/CustomBasicAuth"&gt;http://www.codeplex.com/CustomBasicAuth&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   Again, if you have feature ideas or want to contribute, contact me.
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=f9453fb0-6e2a-4faf-8cf9-62162dc7531e" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=f9453fb0-6e2a-4faf-8cf9-62162dc7531e</comments>
      <category>ASP.NET;IIS;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=735b42bd-85e2-4345-9acc-7e0a14899f5d</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=735b42bd-85e2-4345-9acc-7e0a14899f5d</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=735b42bd-85e2-4345-9acc-7e0a14899f5d</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=735b42bd-85e2-4345-9acc-7e0a14899f5d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I finally found a new home for my ASP.NET InfoCard control:
   </p>
        <p>
          <a href="http://www.codeplex.com/InfoCardSelector">http://www.codeplex.com/InfoCardSelector</a>
        </p>
        <p>
      If you feel like contributing or suggesting new features, you can contact me via this
      page.
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=735b42bd-85e2-4345-9acc-7e0a14899f5d" />
      </body>
      <title>InfoCardSelector is now on Codeplex</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=735b42bd-85e2-4345-9acc-7e0a14899f5d</guid>
      <link>http://www.leastprivilege.com/InfoCardSelectorIsNowOnCodeplex.aspx</link>
      <pubDate>Wed, 16 Apr 2008 16:02:36 GMT</pubDate>
      <description>&lt;p&gt;
   I finally found a new home for my ASP.NET InfoCard control:
&lt;/p&gt;
&lt;p&gt;
   &lt;a href="http://www.codeplex.com/InfoCardSelector"&gt;http://www.codeplex.com/InfoCardSelector&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
   If you feel like contributing or suggesting new features, you can contact me via this
   page.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=735b42bd-85e2-4345-9acc-7e0a14899f5d" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=735b42bd-85e2-4345-9acc-7e0a14899f5d</comments>
      <category>ASP.NET;CardSpace;IdentityModel;WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=170f8682-d133-4e8c-982b-d3d45db15cbf</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=170f8682-d133-4e8c-982b-d3d45db15cbf</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=170f8682-d133-4e8c-982b-d3d45db15cbf</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=170f8682-d133-4e8c-982b-d3d45db15cbf</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://keepitlocked.net/">Alex Smolen</a> did a good <a href="http://keepitlocked.net/archive/2008/04/11/developing-asp-net-in-partial-trust.aspx">write
      up</a> of the various approaches for sandboxing ASP.NET applications. Recommended!
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=170f8682-d133-4e8c-982b-d3d45db15cbf" />
      </body>
      <title>Developing ASP.NET Applications in Medium Trust</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=170f8682-d133-4e8c-982b-d3d45db15cbf</guid>
      <link>http://www.leastprivilege.com/DevelopingASPNETApplicationsInMediumTrust.aspx</link>
      <pubDate>Sat, 12 Apr 2008 05:56:02 GMT</pubDate>
      <description>&lt;p&gt;
   &lt;a href="http://keepitlocked.net/"&gt;Alex Smolen&lt;/a&gt; did a good &lt;a href="http://keepitlocked.net/archive/2008/04/11/developing-asp-net-in-partial-trust.aspx"&gt;write
   up&lt;/a&gt; of the various approaches for sandboxing ASP.NET applications. Recommended!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=170f8682-d133-4e8c-982b-d3d45db15cbf" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=170f8682-d133-4e8c-982b-d3d45db15cbf</comments>
      <category>ASP.NET</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=7a332526-ab1c-4697-9eba-9dd8ecb40e88</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=7a332526-ab1c-4697-9eba-9dd8ecb40e88</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=7a332526-ab1c-4697-9eba-9dd8ecb40e88</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=7a332526-ab1c-4697-9eba-9dd8ecb40e88</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      This took me a while to solve...
   </p>
        <p>
      In the WAS configuration dialog there must be NO whitespaces in the enabled protocols
      configuration. Otherwise you will get this error:
   </p>
        <p>
      "Could not find a base address that matches scheme net.tcp for the endpoint with binding
      NetTcpBinding."
   </p>
        <p>
       
   </p>
        <p>
          <img src="http://www.leastprivilege.com/content/binary/WasSettings.jpg" border="0" />
        </p>
        <p>
      HTH
   </p>
        <p>
       
   </p>
        <img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=7a332526-ab1c-4697-9eba-9dd8ecb40e88" />
      </body>
      <title>Beware of Whitespaces in WAS Configuration</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=7a332526-ab1c-4697-9eba-9dd8ecb40e88</guid>
      <link>http://www.leastprivilege.com/BewareOfWhitespacesInWASConfiguration.aspx</link>
      <pubDate>Thu, 03 Apr 2008 08:04:24 GMT</pubDate>
      <description>&lt;p&gt;
   This took me a while to solve...
&lt;/p&gt;
&lt;p&gt;
   In the WAS configuration dialog there must be NO whitespaces in the enabled protocols
   configuration. Otherwise you will get this error:
&lt;/p&gt;
&lt;p&gt;
   "Could not find a base address that matches scheme net.tcp for the endpoint with binding
   NetTcpBinding."
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
   &lt;img src="http://www.leastprivilege.com/content/binary/WasSettings.jpg" border=0&gt;
&lt;/p&gt;
&lt;p&gt;
   HTH
&lt;/p&gt;
&lt;p&gt;
   &amp;nbsp;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leastprivilege.com/aggbug.ashx?id=7a332526-ab1c-4697-9eba-9dd8ecb40e88" /&gt;</description>
      <comments>http://www.leastprivilege.com/CommentView.aspx?guid=7a332526-ab1c-4697-9eba-9dd8ecb40e88</comments>
      <category>IIS;WCF;Work in Progress</category>
    </item>
    <item>
      <trackback:ping>http://www.leastprivilege.com/Trackback.aspx?guid=46671e74-ded6-4432-be78-cd0b394e4346</trackback:ping>
      <pingback:server>http://www.leastprivilege.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.leastprivilege.com/PermaLink.aspx?guid=46671e74-ded6-4432-be78-cd0b394e4346</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.leastprivilege.com/CommentView.aspx?guid=46671e74-ded6-4432-be78-cd0b394e4346</wfw:comment>
      <wfw:commentRss>http://www.leastprivilege.com/SyndicationService.asmx/GetEntryCommentsRss?guid=46671e74-ded6-4432-be78-cd0b394e4346</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <title>Using Information Cards in ASMX Web Services</title>
      <guid>http://www.leastprivilege.com/PermaLink.aspx?guid=46671e74-ded6-4432-be78-cd0b394e4346</guid>
      <link>http://www.leastprivilege.com/UsingInformationCardsInASMXWebServices.aspx</link>
      <pubDate>Sun, 30 Mar 2008 08:49:07 GMT</pubDate>
      <description>&lt;p&gt;
   As I wrote &lt;a href="http://www.leastprivilege.com/GettingCardSpaceTokensProgrammatically.aspx"&gt;here&lt;/a&gt; -
   an Information Card token is just a string. This means that (with the help of some
   extra plumbing) you can seamlessly integrate cards into "legacy" technologies. Here's
   a sample walkthrough for ASMX web services.
&lt;/p&gt;
&lt;p&gt;
   To transmit the token to the service, I will use a SOAP header. So the first step
   is to define the header:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;[&lt;span style="color: #2b91af"&gt;XmlRoot&lt;/span&gt;(ElementName
   = &lt;span style="color: #a31515"&gt;"InformationCard"&lt;/span&gt;,&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Namespace = &lt;span style="color: #a31515"&gt;"http://schemas.xmlsoap.org/ws/2005/05/identity"&lt;/span&gt;)]&lt;br&gt;
   &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InfoCardTokenHeader&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;SoapHeader&lt;/span&gt;
   &lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Token;&lt;br&gt;&lt;?xml:namespace prefix = o /&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   For metadata support, we can now annotate a web method with this header information:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;[&lt;span style="color: #2b91af"&gt;WebService&lt;/span&gt;(Namespace
   = &lt;span style="color: #a31515"&gt;"urn:leastprivilege"&lt;/span&gt;)]&lt;br&gt;
   [&lt;span style="color: #2b91af"&gt;WebServiceBinding&lt;/span&gt;(ConformsTo = &lt;span style="color: #2b91af"&gt;WsiProfiles&lt;/span&gt;.BasicProfile1_1)]&lt;br&gt;
   &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AsmxService&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;WebService&lt;/span&gt;
   &lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InfoCardTokenHeader&lt;/span&gt; InfoCardToken;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;WebMethod&lt;/span&gt;]&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;SoapHeader&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"InfoCardToken"&lt;/span&gt;,
   Direction = &lt;span style="color: #2b91af"&gt;SoapHeaderDirection&lt;/span&gt;.In)]&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Ping()&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;…&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;br&gt;
   }&lt;o:p&gt;&lt;/o:p&gt;
   &lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
   The client can now use the &lt;em&gt;CardSpaceSelector &lt;/em&gt;API (or my &lt;a href="http://www.leastprivilege.com/IdentityModel"&gt;wrapper&lt;/a&gt;)
   to get a token manually. Afterwards the token gets transmitted using the header:
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0pt; line-height: normal; mso-layout-grid-align: none"&gt;
   &lt;span style="color: blue; font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;static&lt;/span&gt;&lt;span style="font-family: consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[]
   args)&lt;br&gt;
   {&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AsmxService&lt;/span&gt; proxy
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AsmxService&lt;/span&gt;();&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InfoCardTokenHeader&lt;/span&gt; token
   = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;InfoCardTokenHeader&lt;/span&gt;();&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;token.Token = GetInfoCardToken(proxy.Url);&lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;proxy.InformationCard =
   token;&lt;br&gt;
   &lt;br&gt;
   &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(proxy.Ping());&lt;br&gt;
   }&lt;br&gt;
   &lt;br&gt;
   &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; GetInfoCardToken(&lt;span style="color: blue"&gt;str