<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Daniel's Blog At The End Of The Blog Sphere</title><link>http://blogs.msdn.com/danielma/default.aspx</link><description>.NET Architecture, Development &amp; Mexican Food</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>ClickOnce and expired Certificates</title><link>http://blogs.msdn.com/danielma/archive/2007/03/19/clickonce-and-expired-certificates.aspx</link><pubDate>Mon, 19 Mar 2007 02:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1909714</guid><dc:creator>danielma</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/danielma/comments/1909714.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danielma/commentrss.aspx?PostID=1909714</wfw:commentRss><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;As you may know, ClickOnce has an issue with application updates and expired certificates. This issue is documented in the following Knowledge Base article: &lt;A href="http://support.microsoft.com/kb/925521/en-us" mce_href="http://support.microsoft.com/kb/925521/en-us"&gt;KB 925521&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;SPAN style="COLOR: #f79646"&gt;&lt;STRONG&gt;Problem description&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;ClickOnce allows application updates only, if the updated application manifests are signed with the same certificate (publisher) as was used to originally sign the application manifests. However, most CA's like Verisign, and many enterprise customers own CA's generate new certificates with new key pairs and only the same common name (CN).&lt;BR&gt;The certificate is used for the Authenticode signature element &lt;SPAN style="TEXT-DECORATION: underline"&gt;and&lt;/SPAN&gt; for the strong name signature element of the manifest file to protect it against tampering, and to provide identity information for the trust manager. If the signing certificate expires and you publish an application update with a renewed certificate which has different keys, then the update will fail with the error message described in the KB article. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #f79646; FONT-FAMILY: Tahoma"&gt;&lt;STRONG&gt;Problem solution &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;To avoid this issue, you need to use 2 &lt;SPAN style="TEXT-DECORATION: underline"&gt;different&lt;/SPAN&gt; keys for signing: One key for the Authenticode signature - this is the private key from the new / renewed certificate, and one key for the strong name signature. Unfortunately, neither Visual Studio/Mage nor the sign tool (signtool.exe) from the .NET Framework SDK supports this kind of signing. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;However, the Windows Server 2003 R2 Platform SDK (see reference below) contains a newer version of the sign tool with a new switch "/manifest" and with options to use different keys for signing! With this tool you can sign the ClickOnce manifests with different keys for each of the two signatures. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;The following picture shows a manifest file which has been signed with two different private keys. Since the public key token has not changed, ClickOnce recognize it as a valid update. Compare this with your own .application file and you will notice that the public keys are identical (which means the same private key has been used for the two signatures). &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;IMG title="ClickOnce Application Manifest" style="WIDTH: 1142px; HEIGHT: 632px" height=632 alt="ClickOnce Application Manifest" src="http://www.margetic.de/blog/images/manifest.png" width=1142 border=0 mce_src="http://www.margetic.de/blog/images/manifest.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;
&lt;P&gt;The syntax of this tool is: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #eeece1"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Courier New"&gt;signtool sign /manifest /snkc &amp;lt;&lt;STRONG&gt;SN key container name&amp;gt;&lt;/STRONG&gt; /sncsp "Microsoft Enhanced Cryptographic Provider v1.0" /sha1 &lt;STRONG&gt;&amp;lt;hash of publisher cert&amp;gt;&lt;/STRONG&gt; &lt;STRONG&gt;&amp;lt;.application manifest file&amp;gt;&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;STRONG&gt;Example: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="BACKGROUND: #eeece1"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Courier New"&gt;signtool sign /manifest /snkc &lt;STRONG&gt;{7E1383C4-8641-4089-9521-004D4007F21F}&lt;/STRONG&gt; /sncsp "Microsoft Enhanced Cryptographic Provider v1.0" /sha1 &lt;STRONG&gt;D1545335AED57249E32DCC27E4F2513BD24676DE&lt;/STRONG&gt; MyApp.application&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Courier New"&gt;&lt;STRONG&gt;{7E1383C4-8641-4089-9521-004D4007F21F} &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Tahoma"&gt;&lt;SPAN style="FONT-SIZE: 10pt"&gt;is the name of the key container that contains the SN private key&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 9pt"&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Courier New"&gt;&lt;STRONG&gt;D1545335AED57249E32DCC27E4F2513BD24676DE&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;is the hash of the valid publisher certificate used for the Authenticode signature &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;STRONG&gt;How to generate a SN key and store it into a key container? &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;sn -m n &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;&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;&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;&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; // switch to user based container &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;sn -c "Microsoft Enhanced Cryptographic Provider v1.0" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the default CSP &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;sn -k 2048 sign.pfx &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;&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;&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; // generate a new key pair and store it into a key file (or use VS to create a password protected .pfx file) &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;sn -i sign.pfx {7E1383C4-8641-4089-9521-004D4007F21F}&amp;nbsp; // import the key file into a key container (here a GUID is used as the name) &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;SPAN style="TEXT-DECORATION: underline"&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;The SN key is identified by both the /SNKC and /SNCSP. In most cases, the CSP is "Microsoft Enhanced Cryptographic Provider v1.0", but you should substitute it with the actual CSP which contains the private key. &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;You need to sign both .application files (the root and the reference to the updated version), e.g. MyApp.application and MyApp_2_0_0_0.application &lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;STRONG&gt;How to find these values (hash, key container, etc.)?&lt;/STRONG&gt; In the platform SDK there is a tool called CStore.vbs which displays all these information. The location is: \Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Security\capicom\vbs &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;SPAN style="COLOR: #f79646"&gt;&lt;STRONG&gt;&lt;BR&gt;Approach for ClickOnce applications which are already deployed&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;If you have an already deployed ClickOnce application which publisher certificate has expired, and you need to publish an application update, you can use the following approach: &lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Obtain the renewed / new certificate, sign and publish the application update on your server &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Use cstore.vbs and figure out the key container of the &lt;SPAN style="TEXT-DECORATION: underline"&gt;expired&lt;/SPAN&gt; publisher certificate and the hash of the new / renewed certificate &lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Sign your published ClickOnce application (both .application files) with the new sign tool with the key of the expired certificate and the hash of the renewed/new certificate: &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P style="BACKGROUND: #eeece1"&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: Courier New"&gt;signtool sign /manifest /snkc &amp;lt;&lt;STRONG&gt;SN key container name of &lt;SPAN style="TEXT-DECORATION: underline"&gt;expired&lt;/SPAN&gt; certificate&amp;gt;&lt;/STRONG&gt; /sncsp "Microsoft Enhanced Cryptographic Provider v1.0" /sha1 &amp;lt;hash of &lt;SPAN style="TEXT-DECORATION: underline"&gt;new&lt;/SPAN&gt; publisher certificate&amp;gt; .application manifest file&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;After signing with the old key and the new certificate, the application updates seamless as you would expect it. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;SPAN style="COLOR: #f79646"&gt;&lt;STRONG&gt;Security concerns in using a key from an expired certificate?&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;Well, what we are doing here? We are using a key to sign a manifest file. Yes, originally this key was associated with a certificate which now has expired. However, private key associated with a cert is normally not known to anyone, except the holder of the key. The holder of the key must take proper precaution to protect it, which he/she has been doing while the cert was still valid. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;What is the difference to the "normal" SN key (sn.exe) usage? Does it have an assertion to vouch for its authenticity and revocation status? No, it does not! If your generated SN key is compromised today, you have no way to revoke it! So, what is the difference in using a key from an expired cert than in using a fresh generated SN key from beginning? A key is just a key! &lt;STRONG&gt;You have to make sure it is well protected and not compromised! &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;STRONG&gt;&lt;SPAN style="COLOR: #f79646"&gt;&lt;BR&gt;Summary&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;STRONG&gt;Nevertheless, this is not an official recommendation!&lt;/STRONG&gt; The next version of ClickOnce / Visual Studio (Orcas) will solve this issue by design, and you don't need to use different signing keys. This article provides a solution if you are facing this issue today. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;&lt;SPAN style="COLOR: #f79646"&gt;&lt;STRONG&gt;References&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"&gt;The "new" sign tool and cstore.vbs can be found in the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&amp;amp;displaylang=en"&gt;Microsoft Windows Server 2003 R2 Platform SDK&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1909714" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danielma/archive/tags/ClickOnce/default.aspx">ClickOnce</category></item><item><title>SiteMinder and ASP.NET</title><link>http://blogs.msdn.com/danielma/archive/2005/11/16/siteminder-and-asp-net.aspx</link><pubDate>Wed, 16 Nov 2005 21:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:493519</guid><dc:creator>danielma</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/danielma/comments/493519.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danielma/commentrss.aspx?PostID=493519</wfw:commentRss><description>&lt;P&gt;Some weeks ago I was integrating SiteMinder authentication within an ASP.NET application. Fortunately, this was not a big deal because the whole SiteMinder stuff is absolutely transparent to the ASP.NET application. The only thing what&amp;nbsp;must&amp;nbsp;be done (beside the installation and configuration of the Web Agent, Policy Server, etc,&amp;nbsp;of course)&amp;nbsp;is to extract the SiteMinder HTTP headers from the web request and construct a GenericPrincipal object which holds the identity of the authenticated user.&lt;/P&gt;
&lt;P&gt;&lt;FONT size=4&gt;Process Description&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="http://www.margetic.de/blog/images/SMArch_E.png"&gt;&lt;/IMG&gt; 
&lt;OL&gt;
&lt;LI&gt;User types the URL for an ASP.NET application into the web browser. 
&lt;LI&gt;The SiteMinder Web Agent intercepts the request and checks its resource cache. If there is no information in cache about this resource (URL), the Web Agent then sends the request to the Policy Server, asking if the resource is protected. 
&lt;LI&gt;The Policy Server responds indicating that the resource is protected. 
&lt;LI&gt;The Web Agent forwards the request to a login page for challenging the user for their credential. 
&lt;LI&gt;The Web Agent forwards the credentials back to the Policy Server for authentication and authorization. 
&lt;LI&gt;The Policy Server authenticates the user against&amp;nbsp;a&amp;nbsp;directory. After verifying the user’s identity, the Policy Server checks rules in the Policy Store, where user entitlements are stored and grant the user access to the resource. 
&lt;LI&gt;The Policy Server notifies the Web Agent that the user is authenticated and authorized for this resource. 
&lt;LI&gt;The Web Agent constructs several SiteMinder HTTP headers with information about the authenticated user (userid), generates an encrypted session cookie and redirects the request to the original target URL. 
&lt;LI&gt;The request reaches the ASP.NET application where the userid can be extracted from the SiteMinder headers for further processing.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=4&gt;Source Code of HTTPModule to Extract SiteMinder Headers&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;&lt;SPAN class=rem&gt;/// This HttpModule is responsible for retrieving the SiteMinder headers from the web&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;&lt;SPAN class=rem&gt;/// request.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;&lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; SiteMinderModule : IHttpModule, IRequiresSessionState&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   6:  &lt;/SPAN&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   8:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// Required default constructor&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   9:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  10:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; SiteMinderModule()&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  11:  &lt;/SPAN&gt;    { }&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  12:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  13:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  14:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;// Required Dispose Method&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  15:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  16:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Dispose()&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  17:  &lt;/SPAN&gt;    { }&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  18:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  19:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  20:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  21:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// Register for events that are handled within this module&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  22:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  23:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;param name="app"&amp;gt;Application object&amp;lt;/param&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  24:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Init(HttpApplication app)&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  25:  &lt;/SPAN&gt;    {&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  26:  &lt;/SPAN&gt;        app.PreRequestHandlerExecute += &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; EventHandler(Application_PreRequestHandler);&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  27:  &lt;/SPAN&gt;    }&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  28:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  29:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  30:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  31:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// This event occurs just before ASP.NET begins executing a handler such a aspx page.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  32:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// We use this event to extract the SiteMinder headers from the request and construct&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  33:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// our principal object&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  34:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;/summary&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  35:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;param name="sender"&amp;gt;&amp;lt;/param&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  36:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;/// &amp;lt;param name="e"&amp;gt;&amp;lt;/param&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  37:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; Application_PreRequestHandler(Object sender, EventArgs e)&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  38:  &lt;/SPAN&gt;    {&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  39:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (HttpContext.Current.Request.Headers[&lt;SPAN class=str&gt;"SM_USER"&lt;/SPAN&gt;] != &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  40:  &lt;/SPAN&gt;        {&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  41:  &lt;/SPAN&gt;            &lt;SPAN class=rem&gt;// Get a collection of all available HTTP headers from the request&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  42:  &lt;/SPAN&gt;            NameValueCollection coll = HttpContext.Current.Request.Headers;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  43:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  44:  &lt;/SPAN&gt;            &lt;SPAN class=rem&gt;// Retrieve the userid from the SiteMinder header SM_USER&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  45:  &lt;/SPAN&gt;            &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; smUser = coll[&lt;SPAN class=str&gt;"SM_USER"&lt;/SPAN&gt;];&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  46:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  47:  &lt;/SPAN&gt;            &lt;SPAN class=rem&gt;// Create GenericPrincipal with authentication type "SiteMinder".&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  48:  &lt;/SPAN&gt;            GenericIdentity webIdentity = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; GenericIdentity(smUser, &lt;SPAN class=str&gt;"SiteMinder"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  49:  &lt;/SPAN&gt;            GenericPrincipal principal = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; GenericPrincipal(webIdentity);&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  50:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  51:  &lt;/SPAN&gt;            &lt;SPAN class=rem&gt;// TODO: Attach additional attributes to the principal object (e.g. from session&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  52:  &lt;/SPAN&gt;            &lt;SPAN class=rem&gt;// object, DB, directory, etc.)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  53:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  54:  &lt;/SPAN&gt;            HttpContext.Current.User = principal;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  55:  &lt;/SPAN&gt;            Thread.CurrentPrincipal = principal;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  56:  &lt;/SPAN&gt;        }&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  57:  &lt;/SPAN&gt;        &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  58:  &lt;/SPAN&gt;        {&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  59:  &lt;/SPAN&gt;            &lt;SPAN class=rem&gt;// Throw an exception, because SiteMinder headers are not available.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  60:  &lt;/SPAN&gt;        }&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  61:  &lt;/SPAN&gt;    }&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  62:  &lt;/SPAN&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;A future article will cover how to integrate .NET SmartClient applications with SiteMinder.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=493519" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danielma/archive/tags/Development/default.aspx">Development</category><category domain="http://blogs.msdn.com/danielma/archive/tags/SiteMinder/default.aspx">SiteMinder</category><category domain="http://blogs.msdn.com/danielma/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>PDC 2005 ...</title><link>http://blogs.msdn.com/danielma/archive/2005/08/27/456967.aspx</link><pubDate>Sat, 27 Aug 2005 03:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:456967</guid><dc:creator>danielma</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danielma/comments/456967.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danielma/commentrss.aspx?PostID=456967</wfw:commentRss><description>&lt;TABLE border=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A href="http://msdn.microsoft.com/events/pdc/"&gt;&lt;FONT style="BACKGROUND-COLOR: #ffffff" face=Tahoma color=#804000&gt;&lt;IMG alt="PDC 2005" src="http://www.margetic.de/blog/images/MyPDCLogo.gif" align=left border=0 valign="top"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT style="BACKGROUND-COLOR: #ffffff" face=Tahoma color=#804000 size=2&gt;... and fortunately I'll be there, too. See you!&lt;/FONT&gt;&lt;/TD&gt;
&lt;TR&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=456967" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danielma/archive/tags/Development/default.aspx">Development</category></item><item><title>TechEd 2005 Europe ...</title><link>http://blogs.msdn.com/danielma/archive/2005/05/27/422705.aspx</link><pubDate>Fri, 27 May 2005 17:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:422705</guid><dc:creator>danielma</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danielma/comments/422705.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danielma/commentrss.aspx?PostID=422705</wfw:commentRss><description>&lt;TABLE border=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A href="http://www.mseventseurope.com/teched/05/pre/content/default.aspx"&gt;&lt;FONT style="BACKGROUND-COLOR: #ffffff" face=Tahoma color=#804000&gt;&lt;IMG alt="TechEd 2005 Europe - I'll be there" src="http://www.margetic.de/blog/images/illbethere.png" align=left border=0 valign="top"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT style="BACKGROUND-COLOR: #ffffff" face=Tahoma color=#804000 size=2&gt;... I'll be there!&lt;BR&gt;&lt;BR&gt;You can find me somewhere at the &lt;B&gt;Ask The Experts&lt;/B&gt; booth. Feel free to visit me and to just say hello. If you make an evidence photo, I will post it on this blog...&lt;/FONT&gt;&lt;/TD&gt;
&lt;TR&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=422705" width="1" height="1"&gt;</description></item><item><title>I always known this ...</title><link>http://blogs.msdn.com/danielma/archive/2005/05/27/422650.aspx</link><pubDate>Fri, 27 May 2005 13:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:422650</guid><dc:creator>danielma</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/danielma/comments/422650.aspx</comments><wfw:commentRss>http://blogs.msdn.com/danielma/commentrss.aspx?PostID=422650</wfw:commentRss><description>&lt;table&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;A href="http://quiz.ravenblack.net/videogame.pl"&gt;&lt;FONT face=Tahoma color=#804000&gt;&lt;IMG height=80 alt="What Video Game Character Are You? I am a Gauntlet Adventurer." src="http://quiz.ravenblack.net/videogame/14.png" width=150 align=left border=0&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Tahoma color=#804000 size=2&gt;... I am &lt;B&gt;a Gauntlet Adventurer!&lt;/B&gt;&lt;BR&gt;&lt;BR&gt;I strive to improve my living conditions by hoarding gold, food, and sometimes keys and potions. I love adventure, fighting, and&amp;nbsp;&amp;nbsp; particularly winning - especially when there's a prize at stake. I occasionally get lost inside buildings and can't find the exit. I need food badly&lt;/FONT&gt;&lt;/td&gt;&lt;tr&gt;&lt;/table&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=422650" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/danielma/archive/tags/About+Me/default.aspx">About Me</category></item></channel></rss>