<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>mob's dev blog</title>
    <link>http://blog.mike-obrien.net/</link>
    <description>Our eyes met across the crowded hat store. I, a customer, and she a coquettish haberdasher.</description>
    <image>
      <url>http://blog.mike-obrien.net/images/rss.png</url>
      <title>mob's dev blog</title>
      <link>http://blog.mike-obrien.net/</link>
    </image>
    <language>en-us</language>
    <copyright>Mike O'Brien</copyright>
    <lastBuildDate>Tue, 18 Nov 2008 14:10:56 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>mob@mike-obrien.net</managingEditor>
    <webMaster>mob@mike-obrien.net</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/MobsDevBlog" type="application/rss+xml" /><item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=b6621124-bc9e-4abc-8177-bfdf3d4126f7</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,b6621124-bc9e-4abc-8177-bfdf3d4126f7.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,b6621124-bc9e-4abc-8177-bfdf3d4126f7.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=b6621124-bc9e-4abc-8177-bfdf3d4126f7</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
One thing I really love about Linq is how succinctly you can write import and export
code. I've had to do this many times before Linq and it always felt kludgy no matter
how clean you did it (Especially building xml documents). I think the decision to
bake a set based syntax into C# and VB.NET was a great idea. So here is yet another
Linq code sample, aren't there already a million of them out there??
</p>
        <p>
Exporting data from a SQL Server table to xml using Linq2Sql and Link2Xml:
</p>
        <pre class="code">
          <span style="COLOR: #2b91af">TestDataContext </span>dataContext
= <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">TestDataContext</span>(<span style="COLOR: #a31515">@"Data
Source=localhost; Initial Catalog=Test;Integrated Security=True"</span>); <span style="COLOR: #2b91af">XDocument </span>export
= <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XDocument</span>( <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>( <span style="COLOR: #a31515">"clients"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XComment</span>(<span style="COLOR: #a31515">"This
is a comment!"</span>), <span style="COLOR: blue">from </span>client <span style="COLOR: blue">in </span>dataContext.Clients <span style="COLOR: blue">orderby </span>client.State,
client.City <span style="COLOR: blue">select new </span><span style="COLOR: #2b91af">XElement</span>( <span style="COLOR: #a31515">"client"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XAttribute</span>(<span style="COLOR: #a31515">"id"</span>,
client.Id.ToString()), <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>(<span style="COLOR: #a31515">"name"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XText</span>(client.Name)), <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>(<span style="COLOR: #a31515">"address"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XText</span>(client.Address)), <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>(<span style="COLOR: #a31515">"address2"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XText</span>(client.Address2)), <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>(<span style="COLOR: #a31515">"city"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XText</span>(client.City)), <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>(<span style="COLOR: #a31515">"state"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XText</span>(client.State)), <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>(<span style="COLOR: #a31515">"zip"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XText</span>(client.Zip)), <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XElement</span>(<span style="COLOR: #a31515">"comments"</span>, <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">XCData</span>( <span style="COLOR: blue">string</span>.Format(<span style="COLOR: #a31515">"{0}
is based out of {1}."</span>, client.Name, client.State))) ) ) ); export.Save(<span style="COLOR: #a31515">@"D:\Temp\Clients.xml"</span>);</pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
Importing data from an xml document to a SQL Server table using Linq2Xml and Linq2Sql
(<font color="#ff0000"><em>And as Anon pointed out we can do a direct cast since the
XAttribute (And XElement) class define explicit conversion operators for primitive
types. On that note we also dont need to check if the XElement or XAttribute is null.
The Linq2Sql entity defines fields (Or properties) as nullable types and the XElement
and XAttribute classes define conversion operators for nullable primitive types. So
if an attribute or element does not exist the entity value is simply set to null.</em></font>):
</p>
        <pre class="code">
          <span style="COLOR: #2b91af">TestDataContext </span>dataContext
= <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">TestDataContext</span>(<span style="COLOR: #a31515">@"Data
Source=localhost; Initial Catalog=Test;Integrated Security=True"</span>); <span style="COLOR: #2b91af">XDocument </span>document
= <span style="COLOR: #2b91af">XDocument</span>.Load(<span style="COLOR: #a31515">@"D:\Temp\Clients.xml"</span>); <span style="COLOR: blue">var </span>clients
= <span style="COLOR: blue">from </span>client <span style="COLOR: blue">in </span>document.Element(<span style="COLOR: #a31515">"clients"</span>).Elements(<span style="COLOR: #a31515">"client"</span>) <span style="COLOR: blue">select
new </span><span style="COLOR: #2b91af">Client</span>() { Id = (<font color="#0000ff">int</font>)client.Attribute(<span style="COLOR: #a31515">"id"</span>),
Name = (<font color="#0000ff">string</font>)client.Element(<span style="COLOR: #a31515">"name"</span>),
Address = (<font color="#0000ff">string</font>)client.Element(<span style="COLOR: #a31515">"address"</span>),
Address2 = (<font color="#0000ff">string</font>)client.Element(<span style="COLOR: #a31515">"address2"</span>),
City = (<font color="#0000ff">string</font>)client.Element(<span style="COLOR: #a31515">"city"</span>),
State = (<font color="#0000ff">string</font>)client.Element(<span style="COLOR: #a31515">"state"</span>),
Zip = (<font color="#0000ff">string</font>)client.Element(<span style="COLOR: #a31515">"zip"</span>)
}; <span style="COLOR: blue">foreach </span>(<span style="COLOR: blue">var </span>client <span style="COLOR: blue">in </span>clients)
dataContext.Clients.InsertOnSubmit(client); dataContext.SubmitChanges();</pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=b6621124-bc9e-4abc-8177-bfdf3d4126f7" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/457210872" height="1" width="1" /></body>
      <title>Importing and Exporting Data Using Linq</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,b6621124-bc9e-4abc-8177-bfdf3d4126f7.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/457210872/PermaLink,guid,b6621124-bc9e-4abc-8177-bfdf3d4126f7.aspx</link>
      <pubDate>Tue, 18 Nov 2008 14:10:56 GMT</pubDate>
      <description>&lt;p&gt;
One thing I really love about Linq is how succinctly you can write import and export
code. I've had to do this many times before Linq and it always felt kludgy no matter
how clean you did it (Especially building xml documents). I think the decision to
bake a set based syntax into C# and VB.NET was a great idea. So here is yet another
Linq code sample, aren't there already a million of them out there??
&lt;/p&gt;
&lt;p&gt;
Exporting data from a SQL Server table to xml using Linq2Sql and Link2Xml:
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: #2b91af"&gt;TestDataContext &lt;/span&gt;dataContext = &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;TestDataContext&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;@"Data
Source=localhost; Initial Catalog=Test;Integrated Security=True"&lt;/span&gt;); &lt;span style="COLOR: #2b91af"&gt;XDocument &lt;/span&gt;export
= &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XDocument&lt;/span&gt;( &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;( &lt;span style="COLOR: #a31515"&gt;"clients"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XComment&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"This
is a comment!"&lt;/span&gt;), &lt;span style="COLOR: blue"&gt;from &lt;/span&gt;client &lt;span style="COLOR: blue"&gt;in &lt;/span&gt;dataContext.Clients &lt;span style="COLOR: blue"&gt;orderby &lt;/span&gt;client.State,
client.City &lt;span style="COLOR: blue"&gt;select new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;( &lt;span style="COLOR: #a31515"&gt;"client"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XAttribute&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"id"&lt;/span&gt;,
client.Id.ToString()), &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"name"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XText&lt;/span&gt;(client.Name)), &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"address"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XText&lt;/span&gt;(client.Address)), &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"address2"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XText&lt;/span&gt;(client.Address2)), &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"city"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XText&lt;/span&gt;(client.City)), &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"state"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XText&lt;/span&gt;(client.State)), &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"zip"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XText&lt;/span&gt;(client.Zip)), &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XElement&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"comments"&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;XCData&lt;/span&gt;( &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="COLOR: #a31515"&gt;"{0}
is based out of {1}."&lt;/span&gt;, client.Name, client.State))) ) ) ); export.Save(&lt;span style="COLOR: #a31515"&gt;@"D:\Temp\Clients.xml"&lt;/span&gt;);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
Importing data from an xml document to a SQL Server table using Linq2Xml and Linq2Sql
(&lt;font color=#ff0000&gt;&lt;em&gt;And as Anon pointed out we can do a direct cast since the
XAttribute (And XElement) class define explicit conversion operators for primitive
types. On that note we also dont need to check if the XElement or XAttribute is null.
The Linq2Sql entity defines fields (Or properties) as nullable types and the XElement
and XAttribute classes define conversion operators for nullable primitive types. So
if an attribute or element does not exist the entity value is simply set to null.&lt;/em&gt;&lt;/font&gt;):
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: #2b91af"&gt;TestDataContext &lt;/span&gt;dataContext = &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;TestDataContext&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;@"Data
Source=localhost; Initial Catalog=Test;Integrated Security=True"&lt;/span&gt;); &lt;span style="COLOR: #2b91af"&gt;XDocument &lt;/span&gt;document
= &lt;span style="COLOR: #2b91af"&gt;XDocument&lt;/span&gt;.Load(&lt;span style="COLOR: #a31515"&gt;@"D:\Temp\Clients.xml"&lt;/span&gt;); &lt;span style="COLOR: blue"&gt;var &lt;/span&gt;clients
= &lt;span style="COLOR: blue"&gt;from &lt;/span&gt;client &lt;span style="COLOR: blue"&gt;in &lt;/span&gt;document.Element(&lt;span style="COLOR: #a31515"&gt;"clients"&lt;/span&gt;).Elements(&lt;span style="COLOR: #a31515"&gt;"client"&lt;/span&gt;) &lt;span style="COLOR: blue"&gt;select
new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Client&lt;/span&gt;() { Id = (&lt;font color=#0000ff&gt;int&lt;/font&gt;)client.Attribute(&lt;span style="COLOR: #a31515"&gt;"id"&lt;/span&gt;),
Name = (&lt;font color=#0000ff&gt;string&lt;/font&gt;)client.Element(&lt;span style="COLOR: #a31515"&gt;"name"&lt;/span&gt;),
Address = (&lt;font color=#0000ff&gt;string&lt;/font&gt;)client.Element(&lt;span style="COLOR: #a31515"&gt;"address"&lt;/span&gt;),
Address2 = (&lt;font color=#0000ff&gt;string&lt;/font&gt;)client.Element(&lt;span style="COLOR: #a31515"&gt;"address2"&lt;/span&gt;),
City = (&lt;font color=#0000ff&gt;string&lt;/font&gt;)client.Element(&lt;span style="COLOR: #a31515"&gt;"city"&lt;/span&gt;),
State = (&lt;font color=#0000ff&gt;string&lt;/font&gt;)client.Element(&lt;span style="COLOR: #a31515"&gt;"state"&lt;/span&gt;),
Zip = (&lt;font color=#0000ff&gt;string&lt;/font&gt;)client.Element(&lt;span style="COLOR: #a31515"&gt;"zip"&lt;/span&gt;)
}; &lt;span style="COLOR: blue"&gt;foreach &lt;/span&gt;(&lt;span style="COLOR: blue"&gt;var &lt;/span&gt;client &lt;span style="COLOR: blue"&gt;in &lt;/span&gt;clients)
dataContext.Clients.InsertOnSubmit(client); dataContext.SubmitChanges();&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=b6621124-bc9e-4abc-8177-bfdf3d4126f7" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,b6621124-bc9e-4abc-8177-bfdf3d4126f7.aspx</comments>
      <category>.NET 3.5</category>
      <category>C#</category>
      <category>Linq</category>
      <category>SQL Server 2005</category>
      <category>XML/XSL</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,b6621124-bc9e-4abc-8177-bfdf3d4126f7.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=7c9ac3c9-3441-4548-b4f1-c10da94fdf12</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,7c9ac3c9-3441-4548-b4f1-c10da94fdf12.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,7c9ac3c9-3441-4548-b4f1-c10da94fdf12.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=7c9ac3c9-3441-4548-b4f1-c10da94fdf12</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Our build AD account needed the ability stop/start Windows services so that it can
deploy them. I looked all around and found a simple solution using the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&amp;displaylang=en">subinacl
utility from Microsoft</a> (For more info see "Method 3" on <a href="http://support.microsoft.com/kb/288129">this
page</a>.) The following command will give an AD user full rights to the service specified.
I tried to only give it stop and start permissions but couldn't figure out the right
combination of flags to make this happen (And no its not 'TO').
</p>
        <p>
          <font face="Courier New">SUBINACL /SERVICE \\MyServer\MyServiceName /GRANT=MyDomain\MyUser=F</font>
        </p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=7c9ac3c9-3441-4548-b4f1-c10da94fdf12" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/446974951" height="1" width="1" /></body>
      <title>Assigining Rights to an Account to Stop/Start a Windows Service</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,7c9ac3c9-3441-4548-b4f1-c10da94fdf12.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/446974951/PermaLink,guid,7c9ac3c9-3441-4548-b4f1-c10da94fdf12.aspx</link>
      <pubDate>Sun, 09 Nov 2008 00:56:02 GMT</pubDate>
      <description>&lt;p&gt;
Our build AD account needed the ability stop/start Windows services so that it can
deploy them. I looked all around and found a simple solution using the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&amp;amp;displaylang=en"&gt;subinacl
utility from Microsoft&lt;/a&gt; (For more info see "Method 3" on &lt;a href="http://support.microsoft.com/kb/288129"&gt;this
page&lt;/a&gt;.) The following command will give an AD user full rights to the service specified.
I tried to only give it stop and start permissions but couldn't figure out the right
combination of flags to make this happen (And no its not 'TO').
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;SUBINACL /SERVICE \\MyServer\MyServiceName /GRANT=MyDomain\MyUser=F&lt;/font&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=7c9ac3c9-3441-4548-b4f1-c10da94fdf12" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,7c9ac3c9-3441-4548-b4f1-c10da94fdf12.aspx</comments>
      <category>Active Directory</category>
      <category>Windows Server 2003</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,7c9ac3c9-3441-4548-b4f1-c10da94fdf12.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=69358f51-5d6b-42fe-98c0-aa35cb4f581c</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,69358f51-5d6b-42fe-98c0-aa35cb4f581c.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,69358f51-5d6b-42fe-98c0-aa35cb4f581c.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=69358f51-5d6b-42fe-98c0-aa35cb4f581c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The latest version of the Enterprise Library can be downloaded <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=1643758B-2986-47F7-B529-3E41584B6CE5&amp;displaylang=en">here</a>.
I'm happy to find <a href="http://blog.mike-obrien.net/PermaLink,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx">the
bug where the XmlLogFormatter was not escaping invalid characters</a> has been <a href="http://www.codeplex.com/entlib/WorkItem/View.aspx?WorkItemId=13269">fixed</a>!
</p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=69358f51-5d6b-42fe-98c0-aa35cb4f581c" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/436471408" height="1" width="1" /></body>
      <title>Enterprise Library 4.1 Released</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,69358f51-5d6b-42fe-98c0-aa35cb4f581c.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/436471408/PermaLink,guid,69358f51-5d6b-42fe-98c0-aa35cb4f581c.aspx</link>
      <pubDate>Thu, 30 Oct 2008 02:39:12 GMT</pubDate>
      <description>&lt;p&gt;
The latest version of the Enterprise Library can be downloaded &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=1643758B-2986-47F7-B529-3E41584B6CE5&amp;amp;displaylang=en"&gt;here&lt;/a&gt;.
I'm happy to find &lt;a href="http://blog.mike-obrien.net/PermaLink,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx"&gt;the
bug where the XmlLogFormatter was not escaping invalid characters&lt;/a&gt; has been &lt;a href="http://www.codeplex.com/entlib/WorkItem/View.aspx?WorkItemId=13269"&gt;fixed&lt;/a&gt;!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=69358f51-5d6b-42fe-98c0-aa35cb4f581c" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,69358f51-5d6b-42fe-98c0-aa35cb4f581c.aspx</comments>
      <category>.NET</category>
      <category>Enterprise Library</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,69358f51-5d6b-42fe-98c0-aa35cb4f581c.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=e527ba10-77de-4a00-8689-f4bc060f7588</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,e527ba10-77de-4a00-8689-f4bc060f7588.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,e527ba10-77de-4a00-8689-f4bc060f7588.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=e527ba10-77de-4a00-8689-f4bc060f7588</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Adding custom token handlers to the LAB TextFormatter is fairly simple. The following
formatter adds an "arrow" token (" --&gt; ") to  the formatter.
</p>
        <pre class="code">
          <span style="COLOR: blue">using </span>Microsoft.Practices.EnterpriseLibrary.Common.Configuration; <span style="COLOR: blue">using </span>Microsoft.Practices.EnterpriseLibrary.Logging.Configuration; <span style="COLOR: blue">using </span>Microsoft.Practices.EnterpriseLibrary.Logging.Formatters; <span style="COLOR: blue">namespace </span>MyLibrary.Logging.EnterpriseLibrary
{ [<span style="COLOR: #2b91af">ConfigurationElementType</span>(<span style="COLOR: blue">typeof</span>(<span style="COLOR: #2b91af">CustomFormatterData</span>))] <span style="COLOR: blue">public
class </span><span style="COLOR: #2b91af">CustomTextFormatter </span>: <span style="COLOR: #2b91af">TextFormatter </span>{ <span style="COLOR: blue">#region </span>Private
Fields <span style="COLOR: blue">private static readonly </span><span style="COLOR: #2b91af">Dictionary</span>&lt;<span style="COLOR: blue">string</span>, <span style="COLOR: #2b91af">TokenHandler</span>&lt;<span style="COLOR: #2b91af">LogEntry</span>&gt;&gt;
tokenHandlers = <span style="COLOR: blue">new </span><span style="COLOR: #2b91af">Dictionary</span>&lt;<span style="COLOR: blue">string</span>, <span style="COLOR: #2b91af">LogEntry</span>&gt;&gt;(); <span style="COLOR: blue">#endregion
#region </span>Constructors <span style="COLOR: blue">static </span>CustomTextFormatter()
{ tokenHandlers[<span style="COLOR: #a31515">"arrow"</span>] = <span style="COLOR: #2b91af">GenericTextFormatter</span>&lt;<span style="COLOR: #2b91af">LogEntry</span>&gt;
.CreateSimpleTokenHandler(<span style="COLOR: #a31515">" --&gt; "</span>); } <span style="COLOR: blue">public </span>CustomTextFormatter(<span style="COLOR: #2b91af">NameValueCollection </span>parameters)
: <span style="COLOR: blue">this</span>(parameters.Get(<span style="COLOR: #a31515">"template"</span>))
{ } <span style="COLOR: blue">public </span>CustomTextFormatter() : <span style="COLOR: blue">this</span>(<span style="COLOR: blue">null</span>,
tokenHandlers) { } <span style="COLOR: blue">public </span>CustomTextFormatter(<span style="COLOR: blue">string </span>template)
: <span style="COLOR: blue">this</span>(template, tokenHandlers) { } <span style="COLOR: blue">protected </span>CustomTextFormatter(<span style="COLOR: blue">string </span>template, <span style="COLOR: #2b91af">Dictionary</span>&lt;<span style="COLOR: blue">string</span>, <span style="COLOR: #2b91af">TokenHandler</span>&lt;<span style="COLOR: #2b91af">LogEntry</span>&gt;&gt;
extraTokenHandlers) : <span style="COLOR: blue">base</span>(template, extraTokenHandlers)
{ } <span style="COLOR: blue">#endregion </span>} } </pre>
        <p>
A few things to note: 1) If you want to define the formatter in configuration, you
must add the CustomFormatterData attribute to the class. Don't try to add the the
TextFormatterData attribute as I did (Because I did not pay close enough attention
to the documentation!) and spend hours in Reflector trying to figure out why a TextFormatter
object is created and not the derived type... This, by the way, has to do with the
Assembler attribute on the nnnFormatterData class. This attribute references
an assembler class that will instantiate the specific type (In this case the XmlLogFormatter),
NOT the one specified in configuration. You could also define your own custom
FormatterData and Assembler classes but the using the CustomFormatterData class is
much simpler. 2) Again, if you want to define the formatter in configuration, you
will need to add the constructor that accepts the NameValueCollection of configuration
parameters. You can then grab the template parameter from this collection. 3) Create
a static list of handlers that gets initialized once by a static constructor. There
is no need to keep recreating these objects every time the formatter is created.
</p>
        <p>
To define the formatter in configuration, specify the class reference like you normally
would, just point to the new class. You can now use the token you defined in your
class. 
</p>
        <pre class="code">
          <span style="COLOR: blue">&lt;</span>
          <span style="COLOR: #a31515">formatters</span>
          <span style="COLOR: blue">&gt; </span>
          <span style="COLOR: blue"> &lt;</span>
          <span style="COLOR: #a31515">add </span>
          <span style="COLOR: red">name</span>
          <span style="COLOR: blue">=</span>"<span style="COLOR: blue">EventLogFormatter</span>" <span style="COLOR: red">template</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">Timestamp{arrow}{timestamp}</span><span style="COLOR: red">&amp;#xD;&amp;#xA;</span><span style="COLOR: blue">Message{arrow}{message}</span><span style="COLOR: red">&amp;#xD;&amp;#xA;<font color="#0000ff"> ...</font></span>" <span style="COLOR: red">type</span><span style="COLOR: blue">=</span>"<span style="COLOR: blue">MyLibrary.Logging.EnterpriseLibrary.CustomTextFormatter,
MyLibrary</span>" <span style="COLOR: blue">/&gt; &lt;/</span><span style="COLOR: #a31515">formatters</span><span style="COLOR: blue">&gt;</span></pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
The result is as follows:
</p>
        <p>
          <a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/AddingCustomTokenHandlerstotheEnterprise_306/image_2.png">
            <img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" border="0" alt="image" src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/AddingCustomTokenHandlerstotheEnterprise_306/image_thumb.png" width="465" height="296" />
          </a>
        </p>
        <p>
Now obviously you'll want to do more than add a simple token. In our next installment
we will show you how to add a parameterized token. See you next time.
</p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=e527ba10-77de-4a00-8689-f4bc060f7588" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/434309462" height="1" width="1" /></body>
      <title>Adding Custom Token Handlers to the Enterprise Library Logging Application Block TextFormatter</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,e527ba10-77de-4a00-8689-f4bc060f7588.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/434309462/PermaLink,guid,e527ba10-77de-4a00-8689-f4bc060f7588.aspx</link>
      <pubDate>Tue, 28 Oct 2008 04:13:34 GMT</pubDate>
      <description>&lt;p&gt;
Adding custom token handlers to the LAB TextFormatter is fairly simple. The following
formatter adds an "arrow" token (" --&amp;gt; ") to&amp;nbsp; the formatter.
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;using &lt;/span&gt;Microsoft.Practices.EnterpriseLibrary.Common.Configuration; &lt;span style="COLOR: blue"&gt;using &lt;/span&gt;Microsoft.Practices.EnterpriseLibrary.Logging.Configuration; &lt;span style="COLOR: blue"&gt;using &lt;/span&gt;Microsoft.Practices.EnterpriseLibrary.Logging.Formatters; &lt;span style="COLOR: blue"&gt;namespace &lt;/span&gt;MyLibrary.Logging.EnterpriseLibrary
{ [&lt;span style="COLOR: #2b91af"&gt;ConfigurationElementType&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;CustomFormatterData&lt;/span&gt;))] &lt;span style="COLOR: blue"&gt;public
class &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;CustomTextFormatter &lt;/span&gt;: &lt;span style="COLOR: #2b91af"&gt;TextFormatter &lt;/span&gt;{ &lt;span style="COLOR: blue"&gt;#region &lt;/span&gt;Private
Fields &lt;span style="COLOR: blue"&gt;private static readonly &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;TokenHandler&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;LogEntry&lt;/span&gt;&amp;gt;&amp;gt;
tokenHandlers = &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;LogEntry&lt;/span&gt;&amp;gt;&amp;gt;(); &lt;span style="COLOR: blue"&gt;#endregion
#region &lt;/span&gt;Constructors &lt;span style="COLOR: blue"&gt;static &lt;/span&gt;CustomTextFormatter()
{ tokenHandlers[&lt;span style="COLOR: #a31515"&gt;"arrow"&lt;/span&gt;] = &lt;span style="COLOR: #2b91af"&gt;GenericTextFormatter&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;LogEntry&lt;/span&gt;&amp;gt;
.CreateSimpleTokenHandler(&lt;span style="COLOR: #a31515"&gt;" --&amp;gt; "&lt;/span&gt;); } &lt;span style="COLOR: blue"&gt;public &lt;/span&gt;CustomTextFormatter(&lt;span style="COLOR: #2b91af"&gt;NameValueCollection &lt;/span&gt;parameters)
: &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;(parameters.Get(&lt;span style="COLOR: #a31515"&gt;"template"&lt;/span&gt;))
{ } &lt;span style="COLOR: blue"&gt;public &lt;/span&gt;CustomTextFormatter() : &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;,
tokenHandlers) { } &lt;span style="COLOR: blue"&gt;public &lt;/span&gt;CustomTextFormatter(&lt;span style="COLOR: blue"&gt;string &lt;/span&gt;template)
: &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;(template, tokenHandlers) { } &lt;span style="COLOR: blue"&gt;protected &lt;/span&gt;CustomTextFormatter(&lt;span style="COLOR: blue"&gt;string &lt;/span&gt;template, &lt;span style="COLOR: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;TokenHandler&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;LogEntry&lt;/span&gt;&amp;gt;&amp;gt;
extraTokenHandlers) : &lt;span style="COLOR: blue"&gt;base&lt;/span&gt;(template, extraTokenHandlers)
{ } &lt;span style="COLOR: blue"&gt;#endregion &lt;/span&gt;} } &lt;/pre&gt;
&lt;p&gt;
A few things to note: 1) If you want to define the formatter in configuration, you
must add the CustomFormatterData attribute to the class. Don't try to add the the
TextFormatterData attribute as I did (Because I did not pay close enough attention
to the documentation!) and spend hours in Reflector trying to figure out why a TextFormatter
object is created and not the derived type... This, by the way, has to do with the
Assembler attribute on the&amp;nbsp;nnnFormatterData class. This attribute references
an assembler class that will instantiate the specific type (In this case the XmlLogFormatter),
NOT the one specified in configuration.&amp;nbsp;You could also define your own custom
FormatterData and Assembler classes but the using the CustomFormatterData class is
much simpler. 2) Again, if you want to define the formatter in configuration, you
will need to add the constructor that accepts the NameValueCollection of configuration
parameters. You can then grab the template parameter from this collection. 3) Create
a static list of handlers that gets initialized once by a static constructor. There
is no need to keep recreating these objects every time the formatter is created.
&lt;/p&gt;
&lt;p&gt;
To define the formatter in configuration, specify the class reference like you normally
would, just point to the new class. You can now use the token you defined in your
class. 
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;formatters&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;span style="COLOR: blue"&gt; &amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add &lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;EventLogFormatter&lt;/span&gt;" &lt;span style="COLOR: red"&gt;template&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;Timestamp{arrow}{timestamp}&lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;amp;#xD;&amp;amp;#xA;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;Message{arrow}{message}&lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;amp;#xD;&amp;amp;#xA;&lt;font color=#0000ff&gt; ...&lt;/font&gt;&lt;/span&gt;" &lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;MyLibrary.Logging.EnterpriseLibrary.CustomTextFormatter,
MyLibrary&lt;/span&gt;" &lt;span style="COLOR: blue"&gt;/&amp;gt; &amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;formatters&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
The result is as follows:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/AddingCustomTokenHandlerstotheEnterprise_306/image_2.png"&gt;&lt;img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" border=0 alt=image src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/AddingCustomTokenHandlerstotheEnterprise_306/image_thumb.png" width=465 height=296&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Now obviously you'll want to do more than add a simple token. In our next installment
we will show you how to add a parameterized token. See you next time.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=e527ba10-77de-4a00-8689-f4bc060f7588" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,e527ba10-77de-4a00-8689-f4bc060f7588.aspx</comments>
      <category>.NET</category>
      <category>Enterprise Library</category>
      <category>Logging</category>
      <category>Logging Application Block</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,e527ba10-77de-4a00-8689-f4bc060f7588.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=db814660-01fa-493a-a8f6-a40ea041159e</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=db814660-01fa-493a-a8f6-a40ea041159e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I have been having XmlTraceListener woes... None of which are showstoppers just major
time wasters! <font color="#ff0000"><strong>The following bug is fixed as of version
4.1!</strong></font> <strike>The first of which has to do the message. The message
is <strong><em>not</em></strong><em><strong>escaped</strong></em> and/or CDATA qualified.
So if you have an ampersand or greater/less than sign in the message it will throw
this cryptic error:</strike></p>
        <p>
          <strike>An error occurred while parsing EntityName. Line x, position y.</strike>
        </p>
        <p>
          <strike>I ended up manually running the log entry object through the Format() method
on the XmlLogFormatter class to get the raw xml and see what exactly it was complaining
about. Sure enough there was an ampersand. Adding an extension method to the string
class and manually escaping the LogEntry message alleviated this to some degree. Bad
thing is though, the message is escaped for all listeners and you probably don't want
to see HTML entities in your event log entry or email message. I think the only way
around this would be to write your own xml trace listener.</strike>
        </p>
        <pre class="code">
          <strike>
            <span style="COLOR: blue">namespace </span>MyApp.Runtime.Extensions
{ <span style="COLOR: blue">public static class </span></strike>
          <strike>
            <span style="COLOR: #2b91af">String </span>{ <span style="COLOR: blue">public
static string </span>EscapeUnsafeXmlCharacters(<span style="COLOR: blue">this string </span>value)
{ <span style="COLOR: blue">return </span>value.Replace(<span style="COLOR: #a31515">"&lt;"</span>, <span style="COLOR: #a31515">"&amp;lt;"</span>).Replace(<span style="COLOR: #a31515">"&gt;"</span>, <span style="COLOR: #a31515">"&amp;gt;"</span>).Replace(<span style="COLOR: #a31515">"&amp;"</span>, <span style="COLOR: #a31515">"&amp;amp;"</span>);
} } }</strike>
        </pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <p>
Issue #2 has to do with where the log file is saved. The FlatFileTraceListner actually
saves the log file relative to the application root (Where the .config file is). Take
a look at the RootFileNameAndEnsureTargetFolderExists() method in the FormattedTextWriterTraceListener
class (The FlatFileTraceListener's base class). Before it passes the filename to it's
base class constructor, it runs it through this method. The XmlTraceListener on the
other hand does not follow this pattern which had me going nuts trying to figure out
what I was doing wrong (Thinking that it just wasn't saving at all). I wasn't getting
any errors from the XmlTraceListener (More on this below) so I started to get the
feeling that perhaps it was writing to the log but just not where I expected. So I
fired up Process Monitor and didn't see any log writes. Then I switched the app (It
was a web application project BTW) to use the built in web server instead of IIS.
Ran everything again and voilà:
</p>
        <p>
          <a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/EnterpriseLibraryXmlTraceListenerBehavi_142A7/image_2.png">
            <img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" border="0" alt="image" src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/EnterpriseLibraryXmlTraceListenerBehavi_142A7/image_thumb.png" width="566" height="211" />
          </a>
        </p>
        <p>
So it was saving it somewhere else, but only when running under the built in web server.
Looking at the code in reflector you can see that, unlike the FormattedTextWriterTraceListener,
the XmlWriterTraceListener does not modify the path to be the application root before
it passes it to it's base class constructor. So the directory ends up being that of
the entry assembly. Bottom line is you have to supply an explicit path when you're
using the XmlTraceListener in a web application.
</p>
        <p>
This leads me to the third oddity; where it would save running under the builtin web
server but not IIS. The base class, TextWriterTraceListener, calls the EnsureWriter()
method (Shown below) before writing to the file. If it returns true it writes the
entry, otherwise it doesn't. Notice that if there is a UnauthorizedAccessException
it just returns false and then subsequently, in the calling Write method, <strong><em>silently</em></strong> skips
writing. When I was using IIS as my web server (And the code was running as the Network
Service account) I didn't see any exceptions and no log writes were showing up in
Process Monitor. Which was very confusing! But when I switched over to using the built
in web server (Which was obviously running as my interactive account) I saw the log
writes. So when it was running under the Network Service account it obviously did
not have permissions to save the log file to wherever it was trying to save it and
no exception was raised... Very confusing behavior this. Reminds me of the advice
in Jeffrey Richter's CLR Via C# book not to ever swallow exceptions! So keep that
in mind, if you don't see any errors and log writes with the XmlTraceListner, it may
be permissions and/or path related.
</p>
        <p>
Well, hopefully this wasn't too long winded and hopefully it clears up some oddities
with the XmlTraceListener.
</p>
        <pre class="code">
          <span style="COLOR: blue">public class </span>
          <span style="COLOR: #2b91af">TextWriterTraceListener </span>:
TraceListener { <span style="COLOR: blue">public override void </span>Write(<span style="COLOR: blue">string </span>message)
{ <span style="COLOR: blue">if </span>(<span style="COLOR: blue">this</span>.EnsureWriter())
{ <span style="COLOR: blue">if </span>(<span style="COLOR: blue">base</span>.NeedIndent)
{ <span style="COLOR: blue">this</span>.WriteIndent(); } <span style="COLOR: blue">this</span>.writer.Write(message);
} } <span style="COLOR: blue">internal bool </span>EnsureWriter() { <span style="COLOR: blue">bool </span>flag
= <span style="COLOR: blue">true</span>; <span style="COLOR: blue">if </span>(<span style="COLOR: blue">this</span>.writer
== <span style="COLOR: blue">null</span>) { flag = <span style="COLOR: blue">false</span>; <span style="COLOR: blue">if </span>(<span style="COLOR: blue">this</span>.fileName
== <span style="COLOR: blue">null</span>) { <span style="COLOR: blue">return </span>flag;
} Encoding encodingWithFallback = GetEncodingWithFallback(<span style="COLOR: blue">new </span>UTF8Encoding(<span style="COLOR: blue">false</span>)); <span style="COLOR: blue">string </span>fullPath
= Path.GetFullPath(<span style="COLOR: blue">this</span>.fileName); <span style="COLOR: blue">string </span>directoryName
= Path.GetDirectoryName(fullPath); <span style="COLOR: blue">string </span>fileName
= Path.GetFileName(fullPath); <span style="COLOR: blue">for </span>(<span style="COLOR: blue">int </span>i
= 0; i &lt; 2; i++) { <span style="COLOR: blue">try </span>{ <span style="COLOR: blue">this</span>.writer
= <span style="COLOR: blue">new </span>StreamWriter(fullPath, <span style="COLOR: blue">true</span>,
encodingWithFallback, 0x1000); flag = <span style="COLOR: blue">true</span>; <span style="COLOR: blue">break</span>;
} <span style="COLOR: blue">catch </span>(IOException) { fileName = <span style="COLOR: #2b91af">Guid</span>.NewGuid().ToString()
+ fileName; fullPath = Path.Combine(directoryName, fileName); } <span style="COLOR: blue">catch </span>(<span style="COLOR: #2b91af">UnauthorizedAccessException</span>)
{ <span style="COLOR: blue">break</span>; } <span style="COLOR: blue">catch </span>(<span style="COLOR: #2b91af">Exception</span>)
{ <span style="COLOR: blue">break</span>; } } <span style="COLOR: blue">if </span>(!flag)
{ <span style="COLOR: blue">this</span>.fileName = <span style="COLOR: blue">null</span>;
} } <span style="COLOR: blue">return </span>flag; } <span style="COLOR: green">//
Other members removed for brevity... </span>}</pre>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=db814660-01fa-493a-a8f6-a40ea041159e" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/428151229" height="1" width="1" /></body>
      <title>Enterprise Library 4.0 XmlTraceListener Behaving Badly...</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/428151229/PermaLink,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx</link>
      <pubDate>Wed, 22 Oct 2008 03:54:38 GMT</pubDate>
      <description>&lt;p&gt;
I have been having XmlTraceListener woes... None of which are showstoppers just major
time wasters! &lt;font color=#ff0000&gt;&lt;strong&gt;The following bug is fixed as of version
4.1!&lt;/strong&gt;&lt;/font&gt;&amp;nbsp;&lt;strike&gt;The first of which has to do the message. The message
is &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;&lt;strong&gt;escaped&lt;/strong&gt;&lt;/em&gt; and/or CDATA qualified.
So if you have an ampersand or greater/less than sign in the message it will throw
this cryptic error:&lt;/strike&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strike&gt;An error occurred while parsing EntityName. Line x, position y.&lt;/strike&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strike&gt;I ended up manually running the log entry object through the Format() method
on the XmlLogFormatter class to get the raw xml and see what exactly it was complaining
about. Sure enough there was an ampersand. Adding an extension method to the string
class and manually escaping the LogEntry message alleviated this to some degree. Bad
thing is though, the message is escaped for all listeners and you probably don't want
to see HTML entities in your event log entry or email message. I think the only way
around this would be to write your own xml trace listener.&lt;/strike&gt;
&lt;/p&gt;
&lt;pre class=code&gt;&lt;strike&gt;&lt;span style="COLOR: blue"&gt;namespace &lt;/span&gt;MyApp.Runtime.Extensions
{ &lt;span style="COLOR: blue"&gt;public static class &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="COLOR: #2b91af"&gt;String &lt;/span&gt;{ &lt;span style="COLOR: blue"&gt;public
static string &lt;/span&gt;EscapeUnsafeXmlCharacters(&lt;span style="COLOR: blue"&gt;this string &lt;/span&gt;value)
{ &lt;span style="COLOR: blue"&gt;return &lt;/span&gt;value.Replace(&lt;span style="COLOR: #a31515"&gt;"&amp;lt;"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"&amp;amp;lt;"&lt;/span&gt;).Replace(&lt;span style="COLOR: #a31515"&gt;"&amp;gt;"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"&amp;amp;gt;"&lt;/span&gt;).Replace(&lt;span style="COLOR: #a31515"&gt;"&amp;amp;"&lt;/span&gt;, &lt;span style="COLOR: #a31515"&gt;"&amp;amp;amp;"&lt;/span&gt;);
} } }&lt;/strike&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt; 
&lt;p&gt;
Issue #2 has to do with where the log file is saved. The FlatFileTraceListner actually
saves the log file relative to the application root (Where the .config file is). Take
a look at the RootFileNameAndEnsureTargetFolderExists() method in the FormattedTextWriterTraceListener
class (The FlatFileTraceListener's base class). Before it passes the filename to it's
base class constructor, it runs it through this method. The XmlTraceListener on the
other hand does not follow this pattern which had me going nuts trying to figure out
what I was doing wrong (Thinking that it just wasn't saving at all). I wasn't getting
any errors from the XmlTraceListener (More on this below) so I started to get the
feeling that perhaps it was writing to the log but just not where I expected. So I
fired up Process Monitor and didn't see any log writes. Then I switched the app (It
was a web application project BTW) to use the built in web server instead of IIS.
Ran everything again and voilà:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/EnterpriseLibraryXmlTraceListenerBehavi_142A7/image_2.png"&gt;&lt;img style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px" border=0 alt=image src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/EnterpriseLibraryXmlTraceListenerBehavi_142A7/image_thumb.png" width=566 height=211&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
So it was saving it somewhere else, but only when running under the built in web server.
Looking at the code in reflector you can see that, unlike the FormattedTextWriterTraceListener,
the XmlWriterTraceListener does not modify the path to be the application root before
it passes it to it's base class constructor. So the directory ends up being that of
the entry assembly. Bottom line is you have to supply an explicit path when you're
using the XmlTraceListener in a web application.
&lt;/p&gt;
&lt;p&gt;
This leads me to the third oddity; where it would save running under the builtin web
server but not IIS. The base class, TextWriterTraceListener, calls the EnsureWriter()
method (Shown below) before writing to the file. If it returns true it writes the
entry, otherwise it doesn't. Notice that if there is a UnauthorizedAccessException
it just returns false and then subsequently, in the calling Write method, &lt;strong&gt;&lt;em&gt;silently&lt;/em&gt;&lt;/strong&gt; skips
writing. When I was using IIS as my web server (And the code was running as the Network
Service account) I didn't see any exceptions and no log writes were showing up in
Process Monitor. Which was very confusing! But when I switched over to using the built
in web server (Which was obviously running as my interactive account) I saw the log
writes. So when it was running under the Network Service account it obviously did
not have permissions to save the log file to wherever it was trying to save it and
no exception was raised... Very confusing behavior this. Reminds me of the advice
in Jeffrey Richter's CLR Via C# book not to ever swallow exceptions! So keep that
in mind, if you don't see any errors and log writes with the XmlTraceListner, it may
be permissions and/or path related.
&lt;/p&gt;
&lt;p&gt;
Well, hopefully this wasn't too long winded and hopefully it clears up some oddities
with the XmlTraceListener.
&lt;/p&gt;
&lt;pre class=code&gt;&lt;span style="COLOR: blue"&gt;public class &lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;TextWriterTraceListener &lt;/span&gt;:
TraceListener { &lt;span style="COLOR: blue"&gt;public override void &lt;/span&gt;Write(&lt;span style="COLOR: blue"&gt;string &lt;/span&gt;message)
{ &lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.EnsureWriter())
{ &lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(&lt;span style="COLOR: blue"&gt;base&lt;/span&gt;.NeedIndent)
{ &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.WriteIndent(); } &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.writer.Write(message);
} } &lt;span style="COLOR: blue"&gt;internal bool &lt;/span&gt;EnsureWriter() { &lt;span style="COLOR: blue"&gt;bool &lt;/span&gt;flag
= &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.writer
== &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;) { flag = &lt;span style="COLOR: blue"&gt;false&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.fileName
== &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;) { &lt;span style="COLOR: blue"&gt;return &lt;/span&gt;flag;
} Encoding encodingWithFallback = GetEncodingWithFallback(&lt;span style="COLOR: blue"&gt;new &lt;/span&gt;UTF8Encoding(&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;)); &lt;span style="COLOR: blue"&gt;string &lt;/span&gt;fullPath
= Path.GetFullPath(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.fileName); &lt;span style="COLOR: blue"&gt;string &lt;/span&gt;directoryName
= Path.GetDirectoryName(fullPath); &lt;span style="COLOR: blue"&gt;string &lt;/span&gt;fileName
= Path.GetFileName(fullPath); &lt;span style="COLOR: blue"&gt;for &lt;/span&gt;(&lt;span style="COLOR: blue"&gt;int &lt;/span&gt;i
= 0; i &amp;lt; 2; i++) { &lt;span style="COLOR: blue"&gt;try &lt;/span&gt;{ &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.writer
= &lt;span style="COLOR: blue"&gt;new &lt;/span&gt;StreamWriter(fullPath, &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;,
encodingWithFallback, 0x1000); flag = &lt;span style="COLOR: blue"&gt;true&lt;/span&gt;; &lt;span style="COLOR: blue"&gt;break&lt;/span&gt;;
} &lt;span style="COLOR: blue"&gt;catch &lt;/span&gt;(IOException) { fileName = &lt;span style="COLOR: #2b91af"&gt;Guid&lt;/span&gt;.NewGuid().ToString()
+ fileName; fullPath = Path.Combine(directoryName, fileName); } &lt;span style="COLOR: blue"&gt;catch &lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;UnauthorizedAccessException&lt;/span&gt;)
{ &lt;span style="COLOR: blue"&gt;break&lt;/span&gt;; } &lt;span style="COLOR: blue"&gt;catch &lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt;)
{ &lt;span style="COLOR: blue"&gt;break&lt;/span&gt;; } } &lt;span style="COLOR: blue"&gt;if &lt;/span&gt;(!flag)
{ &lt;span style="COLOR: blue"&gt;this&lt;/span&gt;.fileName = &lt;span style="COLOR: blue"&gt;null&lt;/span&gt;;
} } &lt;span style="COLOR: blue"&gt;return &lt;/span&gt;flag; } &lt;span style="COLOR: green"&gt;//
Other members removed for brevity... &lt;/span&gt;}&lt;/pre&gt;&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=db814660-01fa-493a-a8f6-a40ea041159e" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx</comments>
      <category>.NET</category>
      <category>Configuration</category>
      <category>Enterprise Library</category>
      <category>IIS 6</category>
      <category>IIS 7</category>
      <category>Logging</category>
      <category>XML/XSL</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,db814660-01fa-493a-a8f6-a40ea041159e.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=3ff5516a-ea11-49e4-b7fe-33fd9f9169bb</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,3ff5516a-ea11-49e4-b7fe-33fd9f9169bb.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,3ff5516a-ea11-49e4-b7fe-33fd9f9169bb.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=3ff5516a-ea11-49e4-b7fe-33fd9f9169bb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you have a host name set in your hosts file pointing to your loop back address
and you are trying to connect to your <em>local</em> SQL Server instance with this
host name using Windows Auth (SSPI) you may receive one of the following errors depending
on how you have things configured: 
</p>
        <p>
"Login failed for user ''. The user is not associated with a trusted SQL Server connection." 
</p>
        <p>
Or 
</p>
        <p>
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' 
</p>
        <p>
There could be a number of things causing this error (<a href="http://blogs.msdn.com/sql_protocols/archive/2008/05/03/understanding-the-error-message-login-failed-for-user-the-user-is-not-associated-with-a-trusted-sql-server-connection.aspx">here</a>, <a href="http://blogs.msdn.com/sql_protocols/archive/2005/10/22/sql-server-2005-connectivity-issue-troubleshoot-part-i.aspx">here</a>, <a href="http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx">here</a> and <a href="http://blogs.msdn.com/sql_protocols/archive/2005/12/22/506607.aspx">here</a>)
but it in the specific scenario noted above it's probably that an alias is not set
for the SQL Server. I'm not sure exactly why or how this works or why the above scenario
would have an issue but creating an alias seems to resolve it. In fact if you specify
"localhost" or the loopback address as the server name it works fine (Without the
alias). Also when connecting to a remote SQL Server with a host name defined in the
hosts file it works fine as well. hmmmm.... I really couldn't find any info on this
specific scenario and creating the alias seems to resolve it so I finally gave up.
If you have any more info on why this would happen please leave a comment. You can
set the alias as follows: 
</p>
        <ol>
          <li>
1) Open the SQL Server Configuration Manager under Start|Programs| Microsoft SQL Server
20xx| Configuration Tools| SQL Server Configuration Manager.</li>
          <li>
2) Under the SQL Native Client Configuration node select Aliases.</li>
          <li>
3) Right-click and select “New Alias…”.</li>
          <li>
4) Enter the following information and press OK:</li>
        </ol>
        <ol>
          <li>
Alias Name: sql.somedomain.com</li>
          <li>
Port No: 1433</li>
          <li>
Protocol: TCP/IP 
</li>
          <li>
Server: 127.0.0.1</li>
        </ol>
        <p>
The connection string would be as follows:
</p>
        <p>
server=sql.somedomain.com;database=SomeDatabase;Integrated Security=SSPI
</p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=3ff5516a-ea11-49e4-b7fe-33fd9f9169bb" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/415114166" height="1" width="1" /></body>
      <title>Connecting to a local SQL Server with a host name set in the Hosts File using Windows Authentication (SSPI)</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,3ff5516a-ea11-49e4-b7fe-33fd9f9169bb.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/415114166/PermaLink,guid,3ff5516a-ea11-49e4-b7fe-33fd9f9169bb.aspx</link>
      <pubDate>Wed, 08 Oct 2008 20:19:05 GMT</pubDate>
      <description>&lt;p&gt;
If you have a host name set in your hosts file pointing to your loop back address
and you are trying to connect to your &lt;em&gt;local&lt;/em&gt; SQL Server instance with this
host name using Windows Auth (SSPI) you may receive one of the following errors depending
on how you have things configured: 
&lt;p&gt;
"Login failed for user ''. The user is not associated with a trusted SQL Server connection." 
&lt;p&gt;
Or 
&lt;p&gt;
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' 
&lt;p&gt;
There could be a number of things causing this error (&lt;a href="http://blogs.msdn.com/sql_protocols/archive/2008/05/03/understanding-the-error-message-login-failed-for-user-the-user-is-not-associated-with-a-trusted-sql-server-connection.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/sql_protocols/archive/2005/10/22/sql-server-2005-connectivity-issue-troubleshoot-part-i.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/sql_protocols/archive/2005/12/22/506607.aspx"&gt;here&lt;/a&gt;)
but it in the specific scenario noted above it's probably that an alias is not set
for the SQL Server. I'm not sure exactly why or how this works or why the above scenario
would have an issue but creating an alias seems to resolve it. In fact if you specify
"localhost" or the loopback address as the server name it works fine (Without the
alias). Also when connecting to a remote SQL Server with a host name defined in the
hosts file it works fine as well. hmmmm.... I really couldn't find any info on this
specific scenario and creating the alias seems to resolve it so I finally gave up.
If you have any more info on why this would happen please leave a comment. You can
set the alias as follows: 
&lt;ol&gt;
&lt;li&gt;
1) Open the SQL Server Configuration Manager under Start|Programs| Microsoft SQL Server
20xx| Configuration Tools| SQL Server Configuration Manager.&lt;/li&gt;
&lt;li&gt;
2) Under the SQL Native Client Configuration node select Aliases.&lt;/li&gt;
&lt;li&gt;
3) Right-click and select “New Alias…”.&lt;/li&gt;
&lt;li&gt;
4) Enter the following information and press OK:&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;
Alias Name: sql.somedomain.com&lt;/li&gt;
&lt;li&gt;
Port No: 1433&lt;/li&gt;
&lt;li&gt;
Protocol: TCP/IP 
&lt;/li&gt;
&lt;li&gt;
Server: 127.0.0.1&lt;/li&gt;
&lt;/ol&gt;
&gt;
&lt;p&gt;
The connection string would be as follows:
&lt;/p&gt;
&lt;p&gt;
server=sql.somedomain.com;database=SomeDatabase;Integrated Security=SSPI
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=3ff5516a-ea11-49e4-b7fe-33fd9f9169bb" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,3ff5516a-ea11-49e4-b7fe-33fd9f9169bb.aspx</comments>
      <category>.NET</category>
      <category>SQL Server 2005</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,3ff5516a-ea11-49e4-b7fe-33fd9f9169bb.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=0d782b0d-fbf0-4bc8-a00b-1af19984c31a</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,0d782b0d-fbf0-4bc8-a00b-1af19984c31a.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,0d782b0d-fbf0-4bc8-a00b-1af19984c31a.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=0d782b0d-fbf0-4bc8-a00b-1af19984c31a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Yes, there is a lot of classic ASP still out there..... *sigh*... My boss ran into
an issue with a client of ours where we were redirecting to a link with a comma in
it in a classic ASP page. The classic ASP Response.Redirect escapes commas before
performing the redirect therefore invalidating the link (BTW, ASP.NET does not do
this). Unfortunately you cannot change this behavior so the only workaround we could
find is manually setting the HTTP status and location header. 
</p>
        <pre class="code">Response.Status = "302 Object moved"
Response.AddHeader "Location", "http://www.somesite.com/yada,yada,yada/default.html"
Response.End</pre>
        <a href="http://11011.net/software/vspaste">
        </a>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=0d782b0d-fbf0-4bc8-a00b-1af19984c31a" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/414230835" height="1" width="1" /></body>
      <title>Classic ASP Encodes Commas When Doing a Redirect</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,0d782b0d-fbf0-4bc8-a00b-1af19984c31a.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/414230835/PermaLink,guid,0d782b0d-fbf0-4bc8-a00b-1af19984c31a.aspx</link>
      <pubDate>Tue, 07 Oct 2008 22:40:54 GMT</pubDate>
      <description>&lt;p&gt;
Yes, there is a lot of classic ASP still out there..... *sigh*... My boss ran into
an issue with a client of ours where we were redirecting to a link with a comma in
it in a classic ASP page. The classic ASP Response.Redirect escapes commas before
performing the redirect therefore invalidating the link (BTW, ASP.NET does not do
this). Unfortunately you cannot change this behavior so the only workaround we could
find is manually setting the HTTP status and location header. 
&lt;/p&gt;
&lt;pre class="code"&gt;Response.Status = "302 Object moved"
Response.AddHeader "Location", "http://www.somesite.com/yada,yada,yada/default.html"
Response.End&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=0d782b0d-fbf0-4bc8-a00b-1af19984c31a" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,0d782b0d-fbf0-4bc8-a00b-1af19984c31a.aspx</comments>
      <category>Classic ASP</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,0d782b0d-fbf0-4bc8-a00b-1af19984c31a.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=12d9628c-a350-4f7b-a573-9d05429b54e8</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,12d9628c-a350-4f7b-a573-9d05429b54e8.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,12d9628c-a350-4f7b-a573-9d05429b54e8.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=12d9628c-a350-4f7b-a573-9d05429b54e8</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently I had the need to setup multiple SSL enabled sites on my local machine for
development. These sites all had the same root domain but differed by sub domain.
Traditionally you need to have a certificate and an IP address per SSL binding because
of a <a href="http://support.microsoft.com/kb/187504">"chicken or the egg"
problem resolving the host headers in an encrypted HTTP conversation</a>. If you have
multiple sites with a common root domain that require SSL you can get around this
limitation by using a wildcard certificate for all those sites. 
</p>
        <p>
So first I setup mappings in my hosts file (&lt;SystemRoot&gt;\System32\drivers\etc\hosts)
as follows:
</p>
        <p>
          <font size="2" face="Courier New"># SomeSite Dev Mappings 
<br />
127.0.0.1          www.dev.somesite.net 
<br />
127.0.0.1     services.dev.somesite.net 
<br />
127.0.0.1        admin.dev.somesite.net</font>
          <br />
          <br />
Next I need to create a self signed wildcard certificate. If you tried the <a href="http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx">self
signed cert "feature" in IIS7</a> you probably quickly discovered that it
is pretty much worthless since you cannot define the common name (CN), it's automatically
set to the host name (Why does MS have a habit of giving you a powerful, feature rich
car that can only make right turns?). One way to get around this is to generate your
self signed cert with a tool and add it to the local machine store. IIS6 ships with
a util called selfssl but this requires you to install the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=56FC92EE-A71A-4C73-B628-ADE629C89499&amp;displaylang=en">IIS6
ResKit</a> (See more about that <a href="http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx">here</a>).
While this works, it bothers me to install tools from a previous version of IIS to
accomplish this. Shouldn't the newer version of IIS do more than it's predecessor?
One other alternative I found on the <a href="http://en.wikipedia.org/wiki/Internets">internets</a> is
to use the <a href="http://msdn.microsoft.com/en-us/library/bfsktky3.aspx">certificate
creation tool</a> that ships with the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=fe6f2099-b7b4-4f47-a244-c96d69c35dec&amp;displaylang=en">.NET
2.0 SDK</a>. For some reason this "feels" better than using a tool from
IIS6, probably just a mental thing... Plus you probably already have the SDK installed
and are using it. 
</p>
        <p>
First create the self signed issuer certificate which will be set as a root cert authority
(Fill in the red items):
</p>
        <p>
          <font size="2" face="Courier New">"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\makecert.exe"
-n "CN=<font color="#ff0000">My Company Development Root CA</font>,O=<font color="#ff0000">My
Company</font>,OU=<font color="#ff0000">Development</font>,L=<font color="#ff0000">Wallkill</font>,S=<font color="#ff0000">NY</font>,C=<font color="#ff0000">US</font>"
-pe -ss Root -sr LocalMachine -sky exchange -m 120 -a sha1 -len 2048 -r</font>
        </p>
        <p>
Next create a cert for your sites that is issued from this authority. You must specify
the common name (CN=&lt;IssuerName&gt;) you entered above in the issuer name field
below (-in &lt;IssuerName&gt;). Also I'm creating a wildcard certificate that will
serve all sites with the dev.somesite.net root domain as this is a requirement to
use host headers. If I add other sites in the future with a different subdomain I
can choose this certificate and all is good. Specifying an asterisk as the subdomain
will signify this (Fill in the red items):
</p>
        <p>
          <font size="2" face="Courier New">"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\makecert.exe"
-n "CN=<font color="#ff0000"><font color="#000000">*.</font>dev.somesite.net</font>"
-pe -ss My -sr LocalMachine -sky exchange -m 120 -in "<font color="#ff0000">My
Company Development Root CA</font>" -is Root -ir LocalMachine -a sha1 -eku 1.3.6.1.5.5.7.3.1</font>
        </p>
        <p>
You should now see this cert show up in the IIS manager on the "Server Certificates"
page:
</p>
        <p>
          <a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_2.png">
            <img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_thumb.png" width="537" height="161" />
          </a>
        </p>
        <p>
Now again, MS gets you part of the way there in the UI but not all the way. As in
IIS6 (SP1+) you cannot specify a host header for SSL bindings in the IIS7 UI because
of, as mentioned above, <a href="http://support.microsoft.com/kb/187504">issues with
resolving the host headers in an encrypted HTTP request</a>. But since we are using
a wildcard certificate these issues are moot and IIS can do it but we have to configure
it through the command line with the <a href="http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/">new
appcmd util</a>. The following command must be executed on each site that requires
SSL. This command will create the SSL binding and set the host header. Make sure you
specify the correct site name and host header for each site (In red):
</p>
        <p>
          <font size="2" face="Courier New">C:\Windows\System32\inetsrv\appcmd set site /site.name:<font color="#ff0000">MySite</font> /+bindings.[protocol='https',bindingInformation='*:443:<font color="#ff0000">www.dev.somesite.net</font>']</font>
        </p>
        <p>
Next go to the site bindings and you'll now see an SSL binding with a host header
defined (Before this field would be disabled for SSL). You will need to select the
the wildcard certificate you created earlier in the cert drop down and save your changes.
</p>
        <p>
          <a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_6.png">
            <img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_thumb_2.png" width="571" height="395" />
          </a>
        </p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=12d9628c-a350-4f7b-a573-9d05429b54e8" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/383520642" height="1" width="1" /></body>
      <title>Creating a self signed wildcard certificate for IIS7</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,12d9628c-a350-4f7b-a573-9d05429b54e8.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/383520642/PermaLink,guid,12d9628c-a350-4f7b-a573-9d05429b54e8.aspx</link>
      <pubDate>Thu, 04 Sep 2008 19:47:54 GMT</pubDate>
      <description>&lt;p&gt;
Recently I had the need to setup multiple SSL enabled sites on my local machine for
development. These sites all had the same root domain but differed by sub domain.
Traditionally you need to have a certificate and an IP address per SSL binding because
of a &lt;a href="http://support.microsoft.com/kb/187504"&gt;&amp;quot;chicken or the egg&amp;quot;
problem resolving the host headers in an encrypted HTTP conversation&lt;/a&gt;. If you have
multiple sites with a common root domain that require SSL you can get around this
limitation by using a wildcard certificate for all those sites. 
&lt;/p&gt;
&lt;p&gt;
So first I setup mappings in my hosts file (&amp;lt;SystemRoot&amp;gt;\System32\drivers\etc\hosts)
as follows:
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Courier New"&gt;# SomeSite Dev Mappings 
&lt;br /&gt;
127.0.0.1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; www.dev.somesite.net 
&lt;br /&gt;
127.0.0.1&amp;#160;&amp;#160;&amp;#160;&amp;#160; services.dev.somesite.net 
&lt;br /&gt;
127.0.0.1&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; admin.dev.somesite.net&lt;/font&gt; 
&lt;br /&gt;
&lt;br /&gt;
Next I need to create a self signed wildcard certificate. If you tried the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx"&gt;self
signed cert &amp;quot;feature&amp;quot; in IIS7&lt;/a&gt; you probably quickly discovered that it
is pretty much worthless since you cannot define the common name (CN), it's automatically
set to the host name (Why does MS have a habit of giving you a powerful, feature rich
car that can only make right turns?). One way to get around this is to generate your
self signed cert with a tool and add it to the local machine store. IIS6 ships with
a util called selfssl but this requires you to install the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=56FC92EE-A71A-4C73-B628-ADE629C89499&amp;amp;displaylang=en"&gt;IIS6
ResKit&lt;/a&gt; (See more about that &lt;a href="http://codeforeternity.com/blogs/technology/archive/2008/02/15/creating-self-signed-ssl-certificates-on-iis-6-0-and-windows-server-2003.aspx"&gt;here&lt;/a&gt;).
While this works, it bothers me to install tools from a previous version of IIS to
accomplish this. Shouldn't the newer version of IIS do more than it's predecessor?
One other alternative I found on the &lt;a href="http://en.wikipedia.org/wiki/Internets"&gt;internets&lt;/a&gt; is
to use the &lt;a href="http://msdn.microsoft.com/en-us/library/bfsktky3.aspx"&gt;certificate
creation tool&lt;/a&gt; that ships with the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=fe6f2099-b7b4-4f47-a244-c96d69c35dec&amp;amp;displaylang=en"&gt;.NET
2.0 SDK&lt;/a&gt;. For some reason this &amp;quot;feels&amp;quot; better than using a tool from
IIS6, probably just a mental thing... Plus you probably already have the SDK installed
and are using it. 
&lt;/p&gt;
&lt;p&gt;
First create the self signed issuer certificate which will be set as a root cert authority
(Fill in the red items):
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Courier New"&gt;&amp;quot;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\makecert.exe&amp;quot;
-n &amp;quot;CN=&lt;font color="#ff0000"&gt;My Company Development Root CA&lt;/font&gt;,O=&lt;font color="#ff0000"&gt;My
Company&lt;/font&gt;,OU=&lt;font color="#ff0000"&gt;Development&lt;/font&gt;,L=&lt;font color="#ff0000"&gt;Wallkill&lt;/font&gt;,S=&lt;font color="#ff0000"&gt;NY&lt;/font&gt;,C=&lt;font color="#ff0000"&gt;US&lt;/font&gt;&amp;quot;
-pe -ss Root -sr LocalMachine -sky exchange -m 120 -a sha1 -len 2048 -r&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Next create a cert for your sites that is issued from this authority. You must specify
the common name (CN=&amp;lt;IssuerName&amp;gt;) you entered above in the issuer name field
below (-in &amp;lt;IssuerName&amp;gt;). Also I'm creating a wildcard certificate that will
serve all sites with the dev.somesite.net root domain as this is a requirement to
use host headers. If I add other sites in the future with a different subdomain I
can choose this certificate and all is good. Specifying an asterisk as the subdomain
will signify this (Fill in the red items):
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Courier New"&gt;&amp;quot;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\makecert.exe&amp;quot;
-n &amp;quot;CN=&lt;font color="#ff0000"&gt;&lt;font color="#000000"&gt;*.&lt;/font&gt;dev.somesite.net&lt;/font&gt;&amp;quot;
-pe -ss My -sr LocalMachine -sky exchange -m 120 -in &amp;quot;&lt;font color="#ff0000"&gt;My
Company Development Root CA&lt;/font&gt;&amp;quot; -is Root -ir LocalMachine -a sha1 -eku 1.3.6.1.5.5.7.3.1&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
You should now see this cert show up in the IIS manager on the &amp;quot;Server Certificates&amp;quot;
page:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_thumb.png" width="537" height="161" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Now again, MS gets you part of the way there in the UI but not all the way. As in
IIS6 (SP1+) you cannot specify a host header for SSL bindings in the IIS7 UI because
of, as mentioned above, &lt;a href="http://support.microsoft.com/kb/187504"&gt;issues with
resolving the host headers in an encrypted HTTP request&lt;/a&gt;. But since we are using
a wildcard certificate these issues are moot and IIS can do it but we have to configure
it through the command line with the &lt;a href="http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/"&gt;new
appcmd util&lt;/a&gt;. The following command must be executed on each site that requires
SSL. This command will create the SSL binding and set the host header. Make sure you
specify the correct site name and host header for each site (In red):
&lt;/p&gt;
&lt;p&gt;
&lt;font size="2" face="Courier New"&gt;C:\Windows\System32\inetsrv\appcmd set site /site.name:&lt;font color="#ff0000"&gt;MySite&lt;/font&gt; /+bindings.[protocol='https',bindingInformation='*:443:&lt;font color="#ff0000"&gt;www.dev.somesite.net&lt;/font&gt;']&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Next go to the site bindings and you'll now see an SSL binding with a host header
defined (Before this field would be disabled for SSL). You will need to select the
the wildcard certificate you created earlier in the cert drop down and save your changes.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="image" src="http://blog.mike-obrien.net/content/binary/WindowsLiveWriter/Creatingaselfsignedwildcardcertificatefo_C165/image_thumb_2.png" width="571" height="395" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=12d9628c-a350-4f7b-a573-9d05429b54e8" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,12d9628c-a350-4f7b-a573-9d05429b54e8.aspx</comments>
      <category>.NET 2.0</category>
      <category>IIS 7</category>
      <category>SSL</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,12d9628c-a350-4f7b-a573-9d05429b54e8.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=a56297c3-9976-4a8b-9e23-ff4eb914c4ad</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,a56297c3-9976-4a8b-9e23-ff4eb914c4ad.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,a56297c3-9976-4a8b-9e23-ff4eb914c4ad.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a56297c3-9976-4a8b-9e23-ff4eb914c4ad</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I came a cross an excellent course on the <a href="http://webcast.berkeley.edu">Berkeley
webcast site</a> on the history of physics. I really like the coverage of the development
of classical physics starting with Newton. Cathryn really does a good job of getting
you thinking in the context of the time period, avoiding contemporary terms and thought
and helping you to look at things from the perspective of these scientists. She also
does a great job of tying in the religious, political, economical and philosophical
influences of the time and how they affected the thinking of these individuals.
</p>
        <p>
          <table>
            <tbody>
              <tr>
                <td>
                  <img src="http://sciencereview.berkeley.edu/articles/issue14/universitypix/university_01_tn.jpg" />
                </td>
                <td valign="top">
                  <a href="http://webcast.berkeley.edu/course_details.php?seriesid=1906978529">
                    <font size="3">
                      <strong>History
181B Modern Physics: From The Atom to Big Science</strong>
                    </font>
                  </a>
                  <br />
Cathryn Carson 
<br /><br />
"Establishment of the ideas and institutions of modern physics. Undoing the classical
world picture: radioactivity, Einstein, quantum mechanics, philosophical disputes.
The evolving structure of the discipline, links with industry and government, World
War II and the atomic bomb. Postwar conceptual consolidation and the emergence of
big science."</td>
              </tr>
            </tbody>
          </table>
        </p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=a56297c3-9976-4a8b-9e23-ff4eb914c4ad" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/357418931" height="1" width="1" /></body>
      <title>UC Berkeley - History 181B Modern Physics: From The Atom to Big Science</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,a56297c3-9976-4a8b-9e23-ff4eb914c4ad.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/357418931/PermaLink,guid,a56297c3-9976-4a8b-9e23-ff4eb914c4ad.aspx</link>
      <pubDate>Wed, 06 Aug 2008 13:47:12 GMT</pubDate>
      <description>&lt;p&gt;
I came a cross an excellent course on the &lt;a href="http://webcast.berkeley.edu"&gt;Berkeley
webcast site&lt;/a&gt; on the history of physics. I really like the coverage of the development
of classical physics starting with Newton. Cathryn really does a good job of getting
you thinking in the context of the time period, avoiding contemporary terms and thought
and helping you to look at things from the perspective of these scientists. She also
does a great job of tying in the religious, political, economical and philosophical
influences of the time and how they affected the thinking of these individuals.
&lt;/p&gt;
&lt;p&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;img src="http://sciencereview.berkeley.edu/articles/issue14/universitypix/university_01_tn.jpg" /&gt;&lt;/td&gt;
&lt;td valign="top"&gt;
&lt;a href="http://webcast.berkeley.edu/course_details.php?seriesid=1906978529"&gt;&lt;font size="3"&gt;&lt;strong&gt;History
181B Modern Physics: From The Atom to Big Science&lt;/strong&gt;&lt;/font&gt;&lt;/a&gt; 
&lt;br /&gt;
Cathryn Carson 
&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Establishment of the ideas and institutions of modern physics. Undoing the classical
world picture: radioactivity, Einstein, quantum mechanics, philosophical disputes.
The evolving structure of the discipline, links with industry and government, World
War II and the atomic bomb. Postwar conceptual consolidation and the emergence of
big science.&amp;quot;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=a56297c3-9976-4a8b-9e23-ff4eb914c4ad" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,a56297c3-9976-4a8b-9e23-ff4eb914c4ad.aspx</comments>
      <category>Physics</category>
      <category>Science</category>
      <category>UC Berkeley</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,a56297c3-9976-4a8b-9e23-ff4eb914c4ad.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=94ea53ff-af78-4890-8590-153da1e4d077</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,94ea53ff-af78-4890-8590-153da1e4d077.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,94ea53ff-af78-4890-8590-153da1e4d077.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=94ea53ff-af78-4890-8590-153da1e4d077</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://geekswithblogs.net/WillSmith/archive/2008/02/26/msbuild-server-gotcha.aspx">Will
Smith so kindly pointed out</a> that the target file for web application projects
is not installed by the .NET 3.5 redist (Along with msbuild). To fix this you can
copy over the target file from a machine with VS2008 installed to the same folder
on build server. The target file can be found under &lt;ProgramFiles&gt;\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications.
</p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=94ea53ff-af78-4890-8590-153da1e4d077" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/348733097" height="1" width="1" /></body>
      <title>&amp;quot;MS Build Error MSB4019: Microsoft.WebApplication.targets was not found&amp;quot; Error When Building a Web Application Project on a Build Server</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,94ea53ff-af78-4890-8590-153da1e4d077.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/348733097/PermaLink,guid,94ea53ff-af78-4890-8590-153da1e4d077.aspx</link>
      <pubDate>Mon, 28 Jul 2008 20:21:18 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://geekswithblogs.net/WillSmith/archive/2008/02/26/msbuild-server-gotcha.aspx"&gt;Will
Smith so kindly pointed out&lt;/a&gt; that the target file for web application projects
is not installed by the .NET 3.5 redist (Along with msbuild). To fix this you can
copy over the target file from a machine with VS2008 installed to the same folder
on build server. The target file can be found under &amp;lt;ProgramFiles&amp;gt;\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=94ea53ff-af78-4890-8590-153da1e4d077" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,94ea53ff-af78-4890-8590-153da1e4d077.aspx</comments>
      <category>MSBuild</category>
      <category>Visual Studio 2008</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,94ea53ff-af78-4890-8590-153da1e4d077.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=421d58d7-f466-45e0-b772-6dc65ed014d4</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,421d58d7-f466-45e0-b772-6dc65ed014d4.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,421d58d7-f466-45e0-b772-6dc65ed014d4.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=421d58d7-f466-45e0-b772-6dc65ed014d4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
When setting the target framework (IE: nant -buildfile:some.nant -t:net-3.5) the Nant
script fails with a null reference exception and the message "<span>Microsoft
.<b class="highlight">NET</b><b class="highlight">Framework</b><b class="highlight">3</b>.<b class="highlight">5</b> (<b class="highlight">net</b>-<b class="highlight">3</b>.<b class="highlight">5</b>)
is not installed, or not </span><span>correctly configured.</span>" Looks like <a href="http://www.nabble.com/Using-0.86-beta-1-for-.NET-3.5-td15966138.html">this
is resolved in the latest nightly build</a> found <a href="http://nant.sourceforge.net/nightly/latest/">here</a>.
</p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=421d58d7-f466-45e0-b772-6dc65ed014d4" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/348708781" height="1" width="1" /></body>
      <title>Null Reference Exception and &amp;quot;Microsoft .NET Framework 3.5 (net-3.5) is not installed, or not correctly configured&amp;quot; Message When Setting the Target Framework to 3.5 in Nant 0.86</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,421d58d7-f466-45e0-b772-6dc65ed014d4.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/348708781/PermaLink,guid,421d58d7-f466-45e0-b772-6dc65ed014d4.aspx</link>
      <pubDate>Mon, 28 Jul 2008 19:51:55 GMT</pubDate>
      <description>&lt;p&gt;
When setting the target framework (IE: nant -buildfile:some.nant -t:net-3.5) the Nant
script fails with a null reference exception and the message &amp;quot;&lt;span&gt;Microsoft
.&lt;b class="highlight"&gt;NET&lt;/b&gt; &lt;b class="highlight"&gt;Framework&lt;/b&gt; &lt;b class="highlight"&gt;3&lt;/b&gt;.&lt;b class="highlight"&gt;5&lt;/b&gt; (&lt;b class="highlight"&gt;net&lt;/b&gt;-&lt;b class="highlight"&gt;3&lt;/b&gt;.&lt;b class="highlight"&gt;5&lt;/b&gt;)
is not installed, or not &lt;/span&gt;&lt;span&gt;correctly configured.&lt;/span&gt;&amp;quot; Looks like &lt;a href="http://www.nabble.com/Using-0.86-beta-1-for-.NET-3.5-td15966138.html"&gt;this
is resolved in the latest nightly build&lt;/a&gt; found &lt;a href="http://nant.sourceforge.net/nightly/latest/"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=421d58d7-f466-45e0-b772-6dc65ed014d4" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,421d58d7-f466-45e0-b772-6dc65ed014d4.aspx</comments>
      <category>Nant</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,421d58d7-f466-45e0-b772-6dc65ed014d4.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://blog.mike-obrien.net/Trackback.aspx?guid=a231c1cd-4729-41f6-910b-66baddc16e8b</trackback:ping>
      <pingback:server>http://blog.mike-obrien.net/pingback.aspx</pingback:server>
      <pingback:target>http://blog.mike-obrien.net/PermaLink,guid,a231c1cd-4729-41f6-910b-66baddc16e8b.aspx</pingback:target>
      <dc:creator>mob</dc:creator>
      <wfw:comment>http://blog.mike-obrien.net/CommentView,guid,a231c1cd-4729-41f6-910b-66baddc16e8b.aspx</wfw:comment>
      <wfw:commentRss>http://blog.mike-obrien.net/SyndicationService.asmx/GetEntryCommentsRss?guid=a231c1cd-4729-41f6-910b-66baddc16e8b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you are receiving the above error message it may be that you installed the NantContrib
task binaries under the &lt;nant&gt;\bin\<strong><font color="#ff0000">tasks</font></strong>\net\20
folder (As the NantContrib readme.txt specifies). Evidently the "tasks"
folder is now called "extensions" in Nant 0.86. So the proper path would
be &lt;nant&gt;\bin\<strong><font color="#ff0000">extensions</font></strong>\net\20.
</p>
        <img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=a231c1cd-4729-41f6-910b-66baddc16e8b" />
      <xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/MobsDevBlog/~4/348703012" height="1" width="1" /></body>
      <title>&amp;quot;Invalid element &amp;lt;xyz&amp;gt;. Unknown task or datatype.&amp;quot; When Using a NantContrib 0.85 Task With Nant 0.86</title>
      <guid isPermaLink="false">http://blog.mike-obrien.net/PermaLink,guid,a231c1cd-4729-41f6-910b-66baddc16e8b.aspx</guid>
      <link>http://feeds.feedburner.com/~r/MobsDevBlog/~3/348703012/PermaLink,guid,a231c1cd-4729-41f6-910b-66baddc16e8b.aspx</link>
      <pubDate>Mon, 28 Jul 2008 19:42:13 GMT</pubDate>
      <description>&lt;p&gt;
If you are receiving the above error message it may be that you installed the NantContrib
task binaries under the &amp;lt;nant&amp;gt;\bin\&lt;strong&gt;&lt;font color="#ff0000"&gt;tasks&lt;/font&gt;&lt;/strong&gt;\net\20
folder (As the NantContrib readme.txt specifies). Evidently the &amp;quot;tasks&amp;quot;
folder is now called &amp;quot;extensions&amp;quot; in Nant 0.86. So the proper path would
be &amp;lt;nant&amp;gt;\bin\&lt;strong&gt;&lt;font color="#ff0000"&gt;extensions&lt;/font&gt;&lt;/strong&gt;\net\20.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blog.mike-obrien.net/aggbug.ashx?id=a231c1cd-4729-41f6-910b-66baddc16e8b" /&gt;</description>
      <comments>http://blog.mike-obrien.net/CommentView,guid,a231c1cd-4729-41f6-910b-66baddc16e8b.aspx</comments>
      <category>Nant</category>
      <category>NantContrib</category>
    <feedburner:origLink>http://blog.mike-obrien.net/PermaLink,guid,a231c1cd-4729-41f6-910b-66baddc16e8b.aspx</feedburner:origLink></item>
  </channel>
</rss>
