<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Damien McGivern</title><link>http://nimtug.org/blogs/damien-mcgivern/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP2 (Build: 20611.960)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DamienMcGivern" /><feedburner:info uri="damienmcgivern" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>DomainKeys Identified Mail (DKIM) library for .Net C#</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/xIUCXpXEUOU/domainkeys-identified-mail-dkim-library-for-net.aspx</link><pubDate>Mon, 02 May 2011 21:28:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:7633</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>5</slash:comments><description>&lt;p&gt;I&amp;#39;ve just committed code that I&amp;#39;ve been working on for a couple of evenings that enables you to DKIM sign System.Net.Mail.MailMessage objects and send DKIM signed emails. Ideally you should sign emails at the last possible stage, perhaps by your mail server, as if your mail server alters certain headers or the body it could make the signing invalid but in some cases it&amp;#39;s not possible. I was working on adding DKIM signing to Amazon&amp;#39;s Simple Email Server (SES) &lt;a href="http://docs.amazonwebservices.com/ses/latest/APIReference/index.html?API_SendRawEmail.html" target="_blank"&gt;SendRawEmail &lt;/a&gt;service and decided to refractor the code into it&amp;#39;s own library. &lt;/p&gt;&lt;p&gt;The code currently has a dependency on &lt;a href="http://www.bouncycastle.org/%29" target="_blank"&gt;Bouncy Castle Cryptography API&lt;/a&gt; which is used to calculate the SHA256 signature but I plan to remove this once I get it working with my own code.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;You can download the code at &lt;a href="https://github.com/dmcgiv/DKIM.Net"&gt;https://github.com/dmcgiv/DKIM.Net&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=7633" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/DKIM/default.aspx">DKIM</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2011/05/02/domainkeys-identified-mail-dkim-library-for-net.aspx</feedburner:origLink></item><item><title>Keyset does not exist error - WCF - IIS7 - SSL</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/cMSKbSiL2sw/keyset-does-not-exist-error-wcf-iis7-ssl.aspx</link><pubDate>Wed, 23 Feb 2011 11:34:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:6179</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=6179</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2011/02/23/keyset-does-not-exist-error-wcf-iis7-ssl.aspx#comments</comments><description>&lt;p&gt;When I was deploying a website that used WCF services I received the following error when browsing to one of the service files to check that it had been configured correctly.&lt;/p&gt;&lt;p&gt;&lt;font size="1"&gt;&lt;i&gt;&lt;span&gt;Keyset does not exist&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Exception Details: System.Security.Cryptography.CryptographicException: Keyset does not exist&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Source Error: &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Stack Trace:&lt;/span&gt; &lt;/i&gt;&lt;/font&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This error is caused by the account that ASP.Net was running under not having access to the private key of the SSL certificate. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;To give ASP.Net the require permissions.&lt;/p&gt;&lt;p&gt;1) Launch Microsoft Management Consol (MMC) - run mmc&lt;/p&gt;&lt;p&gt;2) Load certificates : File - Add/Remove Snap-in, Select certificates, Click Add, Select Computer Account, Select local&lt;/p&gt;&lt;p&gt;3) Open - Certificates - Personal - Certificates&lt;/p&gt;&lt;p&gt;4) Right click on the certificate - All Tasks - Manage Private Keys&lt;/p&gt;&lt;p&gt;5) Add Network Service (ASP.Net runs under this account on Windows 2008)&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=6179" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/WCF/default.aspx">WCF</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/ASP.NET/default.aspx">ASP.NET</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2011/02/23/keyset-does-not-exist-error-wcf-iis7-ssl.aspx</feedburner:origLink></item><item><title>Amazon Web Services (AWS) Simple Email Service (SES) .Net Wrapper C#</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/PW1ybqkRMk0/amazon-web-services-aws-simple-email-service-ses-net-wrapper-c.aspx</link><pubDate>Thu, 27 Jan 2011 11:10:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:5713</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=5713</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2011/01/27/amazon-web-services-aws-simple-email-service-ses-net-wrapper-c.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;Amazon recently launched a new email sending service called Simple Email Service (SES) &lt;a href="http://aws.amazon.com/about-aws/whats-new/2011/01/25/introducing-amazon-simple-email-service/"&gt;http://aws.amazon.com/about-aws/whats-new/2011/01/25/introducing-amazon-simple-email-service/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Although there were no examples or code for .Net so I&amp;#39;ve created a wrapper which you can get at &lt;a href="https://github.com/dmcgiv/AwsSesWrapper.Net"&gt;https://github.com/dmcgiv/AwsSesWrapper.Net&lt;/a&gt;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=5713" width="1" height="1"&gt;</description><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2011/01/27/amazon-web-services-aws-simple-email-service-ses-net-wrapper-c.aspx</feedburner:origLink></item><item><title>Event Update for 7th Dec</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/WslaGxOzSeg/event-update-for-7th-dec.aspx</link><pubDate>Tue, 07 Dec 2010 16:10:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:5029</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=5029</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2010/12/07/event-update-for-7th-dec.aspx#comments</comments><description>At the last event it was mentioned that they may be an event tonight at the Wellington Park Hotel. Just to confirm there will NOT be any event tonight and we’re looking to organise one soon. We will always confirm events with follow up emails and postings on the blog/site.&lt;br /&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=5029" width="1" height="1"&gt;</description><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2010/12/07/event-update-for-7th-dec.aspx</feedburner:origLink></item><item><title>Moving to VS2010 caused build server to break - errorMSB3454, MSB3454 </title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/BS9X8Ql7l10/moving-to-vs2010-caused-build-server-to-break-errormsb3454-msb3454.aspx</link><pubDate>Tue, 02 Nov 2010 10:17:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:4625</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=4625</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2010/11/02/moving-to-vs2010-caused-build-server-to-break-errormsb3454-msb3454.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;Last night I migrated one of our solutions which contained many dlls projects and a couple of websites from VS2008 SP1 to VS2010, after a few changed to the website configuration the solution was building as expected on my machine.&lt;/p&gt;&lt;p&gt;Committing the changes forced a new build on our build server (&lt;a href="http://www.google.co.uk/url?url=http://ccnet.thoughtworks.com/&amp;amp;rct=j&amp;amp;sa=U&amp;amp;ei=bOnPTMzRAuGI4gbr-dCcBg&amp;amp;ved=0CBQQFjAA&amp;amp;sig2=8CRoKOk_KpwRZyL-QkM0LQ&amp;amp;q=ccnet&amp;amp;usg=AFQjCNF-EiHnYLIsFTiF3FBQjMsUp8y32Q" target="_blank"&gt;CruiseControl.NET&lt;/a&gt;) running on Windows Server 2008 64Bit which shortly failed with the following error:&lt;/p&gt;&lt;p&gt;&lt;font face="courier new,courier" size="2"&gt;&lt;i&gt;C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets&lt;br /&gt;&lt;br /&gt;errorMSB3454: Tracker.exe is required to correctly incrementally generate resources in some circumstances, such as when building on a 64-bit OS using 32-bit MSBuild. This build requires Tracker.exe, but it could not be found. The task is looking for Tracker.exe beneath the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A. To solve the problem, either: 1) Install the Microsoft Windows SDK v7.0A or later. 2) Install Microsoft Visual Studio 2010. 3) Manually set the above registry key to the correct location. Alternatively, you can turn off incremental resource generation by setting the &amp;quot;TrackFileAccess&amp;quot; property to &amp;quot;false&amp;quot;.&lt;/i&gt;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;Searching lead me a post by Brad Wilson &lt;a href="http://bradwilson.typepad.com/blog/2010/05/working-around-build-error-msb3454.html"&gt;Working Around Build Error MSB3454&lt;/a&gt; which I didn&amp;#39;t try but instead tried the solution given in one of the comments which linked to Andy Pook&amp;#39;s post &lt;a href="http://andypook.blogspot.com/2010/06/building-without-visual-studio.html" target="_blank"&gt;Building without Visual Studio&lt;/a&gt;&amp;nbsp; &lt;/p&gt;&lt;p&gt;A quick summary of the post: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;1 Install Microsoft Windows SDK v7.1 (We already had it installed in preparation for the move to VS2010 assuming it would just work) &lt;/p&gt;&lt;p&gt;2 Start Windows SDk 7.2 Command Prompt and enter the following&lt;/p&gt;&lt;p&gt;&lt;font face="courier new,courier"&gt;cd Setup &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="courier new,courier"&gt;WindowsSdkVer –version:v7.1&lt;/font&gt;&lt;/p&gt;&lt;p&gt;3 Also remember to copy the &amp;quot;C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0&amp;quot; folder to the build machine if you want to build web projects.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;MSBuild now used the 7.1 SDK when building VS solution files instead of searching for 7.0A SDK, which is only installed when you install VS2010, and our build server is working again.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=4625" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Windows+Server+2008/default.aspx">Windows Server 2008</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/VS+2008+SP1/default.aspx">VS 2008 SP1</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Windows+SDK/default.aspx">Windows SDK</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Build+Server/default.aspx">Build Server</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/CCNet/default.aspx">CCNet</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2010/11/02/moving-to-vs2010-caused-build-server-to-break-errormsb3454-msb3454.aspx</feedburner:origLink></item><item><title>Detecting ASP.Net AJAX postback - AJAX History  </title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/5YgVqflme1A/detecting-asp-net-ajax-postback-ajax-history.aspx</link><pubDate>Fri, 04 Jun 2010 13:41:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:3503</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=3503</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2010/06/04/detecting-asp-net-ajax-postback-ajax-history.aspx#comments</comments><description>
&lt;p&gt;If you are using &lt;a href="http://www.asp.net/aspnet-in-net-35-sp1/videos/introduction-to-aspnet-ajax-history" title="Introduction to ASP.NET Ajax History" target="_blank"&gt;ASP.Net AJAX History&lt;/a&gt; on a page and the user&amp;#39;s browser has JavaScript disabled you may encounter the error:&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;font color="#ff0000"&gt;A history point can only be created during an asynchronous postback.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;To avoid this error always check the &lt;a href="http://msdn.microsoft.com/en-us/library/bb344905%28v=VS.100%29.aspx" title="ScriptManager Class" target="_blank"&gt;ScriptManager&amp;#39;s&lt;/a&gt; &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.isinasyncpostback.aspx" title="ScriptManager.IsInAsyncPostBack Property " target="_blank"&gt;IsInAsyncPostBack&lt;/a&gt; is true before saving your AJAX history during the postback.Below is an example of a method within the Page&amp;#39;s code behind.&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;


&lt;pre class="brush: c-sharp;"&gt;void SaveAjaxHistory()
{
	var sm = ScriptManager.GetCurrent(this);

	if (sm == null || !sm.IsInAsyncPostBack)
	{
		return;
	}

	sm.GetAjaxHistory().AddHistoryPoint(&amp;quot;name&amp;quot;, &amp;quot;value&amp;quot;);

}

&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;I wrap my AJAX History code in a separate component so I don&amp;#39;t directly use the ScriptManager within the Pages code behind so I use the couple of extension methods below for detecting if the request is an ASP.Net AJAX postback or just a regular postback.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre class="brush: c-sharp;"&gt;using System.Web;
using System.Web.UI;

public static class AjaxPostbackExtension
{

	/// 
	/// Gets a value indicating if the request is the result of an ASP.Net AJAX postback.
	/// 
	public static bool IsAjaxPostback(this HttpRequest request)
	{
		return request.Headers[&amp;quot;X-MicrosoftAjax&amp;quot;] == &amp;quot;Delta=true&amp;quot;;

	}

	/// 
	/// Gets a value indicating if the page is the result of an ASP.Net AJAX postback.
	/// 
	public static bool IsAjaxPostback(this Page page)
	{
		var sm = ScriptManager.GetCurrent(page);
		return (sm != null &amp;amp;&amp;amp; sm.IsInAsyncPostBack);
			
	}
}


&lt;/pre&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=3503" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/ASP.Net++History/default.aspx">ASP.Net  History</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2010/06/04/detecting-asp-net-ajax-postback-ajax-history.aspx</feedburner:origLink></item><item><title>PostBackUrl not working? Make sure JavaScript is enabled.</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/OKquo8-mJXA/postbackurl-not-working-make-sure-javascript-is-enabled.aspx</link><pubDate>Thu, 20 May 2010 11:13:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:3399</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=3399</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2010/05/20/postbackurl-not-working-make-sure-javascript-is-enabled.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;Seems obvious now but this one had me scratching my head for an hour this morning. The web application in question downgrades gracefully if JavaScript isn&amp;#39;t enabled everywhere else except for a couple of pages were we were using &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.postbackurl.aspx"&gt;PostBackUrl &lt;/a&gt;on a button control to get around an issue that required that we use no query strings on the page it was redirecting to and we couldn&amp;#39;t use session state. I was unaware that this feature required JavaScript on the client until today.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;You might be asking yourself - who has JavaScript disabled these days? - well some companies lock down their internal computers for security reasons and one of the lockdowns in this case was disabling JavaScript for IE. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Thankfully I was able to solve the issue by reworking each of the pages so that a POST request wasn’t required anymore and just used a hyperlink. If that hadn’t have been the case I’d have had to create a html form outside of the ASP.Net form to get it to work without JavaScript. &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=3399" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/JavaScript/default.aspx">JavaScript</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2010/05/20/postbackurl-not-working-make-sure-javascript-is-enabled.aspx</feedburner:origLink></item><item><title>Special offer from O'Reilly for NIMTUG members</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/hGwCcHoebAM/special-offer-from-oreilly-for-nimtug-members.aspx</link><pubDate>Tue, 15 Dec 2009 13:06:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2683</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2683</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/12/15/special-offer-from-oreilly-for-nimtug-members.aspx#comments</comments><description>&lt;p&gt;Along with your 35% discount off print books, you can now get &lt;i&gt;45% off all ebooks&lt;/i&gt; you purchase direct from &lt;a href="http://oreilly.com/" target="_blank"&gt;oreilly.com&lt;/a&gt; for a limited time.&lt;/p&gt;

&lt;p&gt;When you buy an O&amp;#39;Reilly ebook you get lifetime access to the book,
and whenever possible we make it available to you in four, DRM-free
file formats--PDF, .epub, Kindle-compatible .mobi, and Android
ebook--that you can use on the devices of your choice. Our ebook files
are fully searchable, and you can cut-and-paste and print them. We also
alert you when we&amp;#39;ve updated the files with corrections and additions.&lt;/p&gt;

&lt;p&gt;Just use code &lt;i&gt;DSUG&lt;/i&gt; when ordering online at &lt;a href="http://nimtug.org/controlpanel/blogs/www.oreilly.com/store" target="_blank"&gt;www.oreilly.com/store&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2683" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/NIMTUG/default.aspx">NIMTUG</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Offers/default.aspx">Offers</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/12/15/special-offer-from-oreilly-for-nimtug-members.aspx</feedburner:origLink></item><item><title>SQL Error 30080 - The full-text population on table [table name] cannot be started because the full-text catalog is importing data from existing catalogs.</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/YmYPOhOXv-8/sql-error-30080-the-full-text-population-on-table-table-name-cannot-be-started-because-the-full-text-catalog-is-importing-data-from-existing-catalogs.aspx</link><pubDate>Thu, 22 Oct 2009 14:02:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2498</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2498</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/10/22/sql-error-30080-the-full-text-population-on-table-table-name-cannot-be-started-because-the-full-text-catalog-is-importing-data-from-existing-catalogs.aspx#comments</comments><description>&lt;p&gt;Earlier today I received an error while running an update script on a client&amp;#39;s SQL Server 2008 database. The script was trying to add FTS to a new field in the table&lt;/p&gt;&lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/cc645727.aspx" title="SQL 2008 Error code 30080 details"&gt;error code 30080&lt;/a&gt; had the message The full-text population on table [table name] cannot be started because the
full-text catalog is importing data from existing catalogs. After the
import operation finishes, rerun the command.&lt;/p&gt;&lt;p&gt;I search the web but didn&amp;#39;t get much help as the only solution I could find involved restarting the SQL Server which wasn&amp;#39;t an option. Also there wasn&amp;#39;t any additional help in the SQL logs, I tried restoring the database and updating again (only same issue occurred) and even waited for an hour then trying the script again.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;In the end my solution was to:&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In SQL Server Management Studio open Database &amp;gt; Storage &amp;gt; Full Text Catalogs &amp;gt; Right click Properties&amp;nbsp; &lt;/p&gt;&lt;p&gt;In the general setting select &amp;#39;Rebuild catalog&amp;#39; and click OK.&lt;/p&gt;&lt;p&gt;Then I can run the script without errors.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I&amp;#39;m not sure why this issue occurred in the first place but at least the database is updated and running as expected now. Hope this helps anyone with the same issue.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2498" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/SQL/default.aspx">SQL</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/10/22/sql-error-30080-the-full-text-population-on-table-table-name-cannot-be-started-because-the-full-text-catalog-is-importing-data-from-existing-catalogs.aspx</feedburner:origLink></item><item><title>UK Students to get Windows 7 for £30</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/xU-mrx63t-c/uk-students-to-get-windows-7-for-163-30.aspx</link><pubDate>Thu, 17 Sep 2009 16:22:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2446</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2446</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/09/17/uk-students-to-get-windows-7-for-163-30.aspx#comments</comments><description>&lt;p&gt;From 1st Oct Microsoft are offering UK students with a valid uni/college email address either Windows 7 Home Premium or Windows 7 Professional for only £30 &lt;/p&gt;&lt;p&gt;For more information see &lt;a href="http://www.microsoft.com/uk/windows/studentoffer/" target="_blank"&gt;http://www.microsoft.com/uk/windows/studentoffer/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://www.microsoft.com/library/media/2057/uk/windows/images/Windows7.png" height="64" width="400" alt="" /&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2446" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/windows+7/default.aspx">windows 7</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Student/default.aspx">Student</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Offer/default.aspx">Offer</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/09/17/uk-students-to-get-windows-7-for-163-30.aspx</feedburner:origLink></item><item><title>Google Page Speed - Firefox/Firebug Add-On - Web Developer Tool</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/bwTqgaFYwcU/google-page-speed-firefox-firebug-add-on-web-developer-tool.aspx</link><pubDate>Tue, 11 Aug 2009 08:13:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2394</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2394</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/08/11/google-page-speed-firefox-firebug-add-on-web-developer-tool.aspx#comments</comments><description>&lt;p&gt;Yesterday &lt;a href="http://googleblog.blogspot.com/2009/08/new-tools-for-google-services-for.html" title="Page Speed, Web Elements "&gt;google announced some new tools and services for web developers&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;i&gt;We&amp;#39;ve just added new tools to the suite:&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;i&gt;&lt;a href="http://www.google.com/webelements/"&gt;Web Elements&lt;/a&gt;
allows your customers to enhance their websites with the ease of
cut-and-paste. Webmasters can provide maps, real-time news, calendars,
presentations, spreadsheets and YouTube videos on their sites. With the
Conversation Element, websites can create more engagement with their
communities. The Custom Search Element provides inline search over your
own site (or others you specify) without having to write any code and
various options to &lt;a href="http://googlecustomsearch.blogspot.com/2009/08/custom-search-with-custom-style-peanut.html"&gt;customize further&lt;/a&gt;. &lt;/i&gt;&lt;/li&gt;

&lt;li&gt;&lt;i&gt;&lt;a href="http://code.google.com/speed/page-speed/"&gt;Page Speed&lt;/a&gt;
allows webmasters to measure the performance of their websites.
Snappier websites help users find things faster; the recommendations
from these latency tools allow hosters and webmasters to optimize
website speed. These techniques can help hosters reduce resource use
and optimize network bandwidth.&lt;/i&gt;&lt;/li&gt;

&lt;li&gt;&lt;i&gt;The &lt;a href="http://www.google.com/webmasters/provider/tips.html"&gt;Tips for Hosters page&lt;/a&gt;
offers a set of tips for hosters for creating a richer website hosting
platform. Hosters can improve the convenience and accessibility of
tools, while at the same time saving platform costs and earning
referral fees. Tips include the use of analytics tools such as Google
Analytics to help webmasters understand their traffic and linguistic
tools such as &lt;a href="http://translate.google.com/translate_tools?hl=en"&gt;Google Translate&lt;/a&gt; to help websites reach a broader audience.&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;I&amp;#39;m impressed by &lt;a href="http://code.google.com/speed/page-speed/" title="Google Page Speed"&gt;Page Speed&lt;/a&gt; which is a &lt;a href="http://www.mozilla.com/firefox/" title="Firefox Browser"&gt;Firefox&lt;/a&gt;/&lt;a href="http://getfirebug.com/%20" title="Firebug Firefox Web Developer Add-On"&gt;Firebug &lt;/a&gt;add-on  for web developers. If you are familiar with &lt;a href="http://developer.yahoo.com/yslow/" title="Yahoo! YSlow Firefox Web Developer Add-On"&gt;Yahoo&amp;#39;s YSlow&lt;/a&gt; (if not you should be) which is also a FF add-on it offers similar features in that it enables you to analyse the loading of web pages, rates how good the load time is and &lt;a href="http://code.google.com/speed/page-speed/docs/rules_intro.html" title="Page Speed Rules"&gt;suggests how you could improve page load times&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;A couple of features that I like that are not available in YSlow are:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/speed/page-speed/docs/rendering.html#UseEfficientCSSSelectors%20"&gt;Use Efficient CSS Selectors&lt;/a&gt; - lists those CSS selectors that may slow down the user&amp;#39;s experience&lt;/p&gt;

&lt;p&gt;&lt;a href="http://nimtug.org/blogs/damien-mcgivern/efficient_css_selectors.png"&gt;&lt;img src="http://nimtug.org/blogs/damien-mcgivern/efficient_css_selectors.png" border="0" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/speed/page-speed/docs/payload.html#RemoveUnusedCSS" target="_blank"&gt;Remove unused CSS &lt;/a&gt;- lists all the CSS that is not used in a page, great for helping you to remove CSS that is no longer used or refractor large CSS files.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://nimtug.org/blogs/damien-mcgivern/remove_css.png"&gt;&lt;img src="http://nimtug.org/blogs/damien-mcgivern/remove_css.png" border="0" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/speed/page-speed/docs/using.html#activities" target="_blank"&gt;Page Speed Activity &lt;/a&gt;- enables you to record your activity on a website over multiple pages and see what the browser is doing and spending time on.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://nimtug.org/blogs/damien-mcgivern/recorder.png"&gt;&lt;img src="http://nimtug.org/blogs/damien-mcgivern/recorder.png" border="0" alt="" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;I highly recommend checking out this add-on - I think it&amp;#39;s a great tool. &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fnimtug.org%2fblogs%2fdamien-mcgivern%2farchive%2f2009%2f08%2f11%2fgoogle-page-speed-firefox-firebug-add-on-web-developer-tool.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fnimtug.org%2fblogs%2fdamien-mcgivern%2farchive%2f2009%2f08%2f11%2fgoogle-page-speed-firefox-firebug-add-on-web-developer-tool.aspx" alt="kick it on DotNetKicks.com" border="0" /&gt;&lt;/a&gt;

&lt;a href="http://dotnetshoutout.com/Google-Page-Speed-FirefoxFirebug-Add-On-Web-Developer-Tool-Damien-McGivern"&gt;&lt;img src="http://dotnetshoutout.com/image.axd?url=http%3A%2F%2Fnimtug.org%2Fblogs%2Fdamien-mcgivern%2Farchive%2F2009%2F08%2F11%2Fgoogle-page-speed-firefox-firebug-add-on-web-developer-tool.aspx" alt="Shout it" style="border:0px none;" /&gt;&lt;/a&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2394" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Firefox/default.aspx">Firefox</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/web+development/default.aspx">web development</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/08/11/google-page-speed-firefox-firebug-add-on-web-developer-tool.aspx</feedburner:origLink></item><item><title>WCF CommunicationObjectFaultedException " cannot be used for communication because it is in the Faulted state"  MessageSecurityException "An error occurred when verifying security for the message"</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/gxSjjpUNZ6A/wcf-communicationobjectfaultedexception-quot-cannot-be-used-for-communication-because-it-is-in-the-faulted-state-quot-messagesecurityexception-quot-an-error-occurred-when-verifying-security-for-the-message-quot.aspx</link><pubDate>Tue, 26 May 2009 12:06:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2320</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>16</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2320</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/26/wcf-communicationobjectfaultedexception-quot-cannot-be-used-for-communication-because-it-is-in-the-faulted-state-quot-messagesecurityexception-quot-an-error-occurred-when-verifying-security-for-the-message-quot.aspx#comments</comments><description>		    
&lt;p&gt;
I&amp;#39;ve just spent a couple of hours trying to track down a customer issue with one of our WCF services. Below was part of the unit test I was suing to test the service.&lt;br /&gt;&lt;/p&gt;

&lt;pre class="brush: c-sharp;"&gt;using (var client = new MemberServiceClient())
{
    client.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings[&amp;quot;username&amp;quot;];
    client.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings[&amp;quot;password&amp;quot;];
    client.CreateMember(mem);
    client.DeleteMember(mem.ExternalRef);
}
&lt;/pre&gt;


&lt;p&gt;and the exception it was throwing was:&lt;br /&gt;&lt;/p&gt;

&lt;pre class="brush: c-sharp;"&gt;failed: System.ServiceModel.CommunicationObjectFaultedException : The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
	
	Server stack trace: 
	at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
	
	Exception rethrown at [0]: 
	at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
	at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp;amp; msgData, Int32 type)
	at System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
	at System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
	at System.ServiceModel.ClientBase`1.Close()
	at System.ServiceModel.ClientBase`1.System.IDisposable.Dispose()

&lt;/pre&gt;

&lt;p&gt;When I debugged the code the code actually fails at the CreateMember line not at the close method indicated at by the stack trace. Then I realised that this was one of thoes WCF silly moments - don&amp;#39;t use using blocks!. Yes believe it or not if you use a using block around a WCF client and it fails when the using block calls the dispose method it throws a new excpetion masking the real exception. &lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;The code below is some helper methods we use for making WCF clients are cleaned up correctly.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;


&lt;pre class="brush: c-sharp;"&gt;/// &amp;lt;summary&amp;gt;
/// WCF proxys do not clean up properly if they throw an exception. This method ensures that the service proxy is handeled correctly.
/// Do not call TService.Close() or TService.Abort() within the action lambda.
/// &amp;lt;/summary&amp;gt;
/// &amp;lt;typeparam name=&amp;quot;TService&amp;quot;&amp;gt;The type of the service to use&amp;lt;/typeparam&amp;gt;
/// &amp;lt;param name=&amp;quot;action&amp;quot;&amp;gt;Lambda of the action to performwith the service&amp;lt;/param&amp;gt;

public static void Using&amp;lt;TService&amp;gt;(Action&amp;lt;TService&amp;gt; action)
	where TService : ICommunicationObject, IDisposable, new()
{
	var service = new TService();
	bool success = false;
	try
	{
		action(service);
		if (service.State != CommunicationState.Faulted)
		{
			service.Close();
			success = true;
		}
	}
	finally
	{
		if (!success)
		{
			service.Abort();
		}
	}
}

&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Changing the code to using our service helper methods.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre class="brush: c-sharp;"&gt;ServiceHelper.Using(
    client =&amp;gt;

        {
            client.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings[&amp;quot;username&amp;quot;];
            client.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings[&amp;quot;password&amp;quot;];
            client.CreateMember(mem);
            client.DeleteMember(mem.ExternalRef);
        }
    );

&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Now the code exposed the actual exception that was causing the issue.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre class="brush: c-sharp;"&gt;failed: System.ServiceModel.Security.MessageSecurityException : An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
  ----&amp;gt; System.ServiceModel.FaultException : An error occurred when verifying security for the message.
	
	Server stack trace: 
	at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
	at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
	at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
	at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
	at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
	at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
	at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
	at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
	at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
	at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
	at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
	at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
	at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
	at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)


&lt;/pre&gt;

&lt;p&gt;This exception had me stumped as I had never come across it before but after a bit of digging I discovered that the server time was 7 minutes late and that changing the time fixed the issue. Still trying to figure out how the server&amp;#39;s time got out of synced.&lt;br /&gt;&lt;/p&gt;

&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2320" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/WCF/default.aspx">WCF</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Debugging/default.aspx">Debugging</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/26/wcf-communicationobjectfaultedexception-quot-cannot-be-used-for-communication-because-it-is-in-the-faulted-state-quot-messagesecurityexception-quot-an-error-occurred-when-verifying-security-for-the-message-quot.aspx</feedburner:origLink></item><item><title>XML Linq requires correct namespace for all XElements</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/4d6ko9E_vTk/xml-linq-requires-correct-namespace-for-all-xelements.aspx</link><pubDate>Sun, 24 May 2009 19:58:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2315</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2315</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/24/xml-linq-requires-correct-namespace-for-all-xelements.aspx#comments</comments><description>
&lt;p&gt;I&amp;#39;ve been teaching myself &lt;a href="http://www.asp.net/mvc/" title="ASP.Net MVC"&gt;ASP.Net MVC&lt;/a&gt; during any free time I get at the weekends. I started a simple test project which has developed into the &lt;a href="http://nimtug.org/events/" title="NIMTUG Events"&gt;events section on NIMTUG&lt;/a&gt;. Yesterday I was looking for a way to easily create search engine sitemaps for the event and sepaker pages and I found &lt;a href="http://robtennyson.us/" title="Robert Tennyson&amp;#39;s Blog"&gt;Robert Tennyson&amp;#39;s&lt;/a&gt; post &lt;a href="http://robtennyson.us/post/2008/10/16/Dynamic-sitemaps-with-ASPNET-MVC.aspx" title="ASP.Net MVC Sitemaps"&gt;Dynamic sitemaps with ASP.NET MVC&lt;/a&gt; which seems very easy indeed. With a couple of changes I had the sitemaps working and so submitted them to google only to be notified a couple of hours later that they had failed with the error &amp;quot;Invalid Namespace&amp;quot;.&lt;/p&gt;

&lt;p&gt;I should have validated the outputed Xml using the &lt;a href="http://www.validome.org/google/validate" title="Google Sitemap Validator"&gt;Google Sitemap Validator&lt;/a&gt; but instead I had only tested the xml output in the browser which hid the root namespace (xmlns attribute) but more importantly also hid an empty namespace on all the url elements. &lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;
&amp;lt;urlset xmlns=&amp;quot;http://www.sitemaps.org/schemas/sitemap/0.9&amp;quot;&amp;gt;
  &amp;lt;url xmlns=&amp;quot;&amp;quot;&amp;gt;
    &amp;lt;loc&amp;gt;http://nimtug.org/events/speaker/details/41&amp;lt;/loc&amp;gt;
   &amp;lt;lastmod&amp;gt;2009-05-23&amp;lt;/lastmod&amp;gt;
  &amp;lt;/url&amp;gt;
  &amp;lt;url xmlns=&amp;quot;&amp;quot;&amp;gt;
    &amp;lt;loc&amp;gt;http://nimtug.org/events/speaker/details/23&amp;lt;/loc&amp;gt;

    &amp;lt;lastmod&amp;gt;2009-05-23&amp;lt;/lastmod&amp;gt;
  &amp;lt;/url&amp;gt; 
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;It appears that with LINQ to XMl you have to add the correct namespace to every XmlElement which seems like over kill to me as the child elements are supposed to inherit their namespace from their parent (as you would expect) - if anyone knows of an easier way please let me know. My fix was to just add the namespace to each XElement constructor.&lt;br /&gt;&lt;/p&gt;

&lt;pre class="brush: c-sharp;"&gt;protected string GetAlsoluteUrl(object routeValues)
{
    var values = new RouteValueDictionary(routeValues);
    var context = new RequestContext(HttpContext, RouteData);

    string url = RouteTable.Routes.GetVirtualPath(context, values).VirtualPath;

    return new Uri(Request.Url, url).AbsoluteUri;
}

protected ActionResult CreateSiteMap&amp;lt;TModel, TID&amp;gt;(IEnumerable&amp;lt;TModel&amp;gt; items, Func&amp;lt;TModel, TID&amp;gt; getID,
                                                  string controllerName, string actionName)
{
    // XML LINQ requires that ALL XElements have the correct namespace 
    XNamespace xmlns = &amp;quot;http://www.sitemaps.org/schemas/sitemap/0.9&amp;quot;;

    var root = new XElement(xmlns + &amp;quot;urlset&amp;quot;);
    foreach (TModel item in items)
    {
        object routeValues =
            new
                {
                    id = getID(item),
                    controller = controllerName,
                    action = actionName
                };


        // only add last modified element if we can get the date
        XElement lastMod = null;
        var lm = item as IObjectTimes;
        if (lm != null)
        {
            lastMod = new XElement(xmlns + &amp;quot;lastmod&amp;quot;, (lm.Updated ?? lm.Created).ToString(&amp;quot;yyyy-MM-dd&amp;quot;));
        }
        root.Add(new XElement(xmlns + &amp;quot;url&amp;quot;,
                              new XElement(xmlns + &amp;quot;loc&amp;quot;, GetAlsoluteUrl(routeValues)), lastMod
                     )
            );
    }


    using (var memoryStream = new MemoryStream())
    {
        using (var writer = new StreamWriter(memoryStream, Encoding.UTF8))
        {
            root.Save(writer);
        }

        return Content(Encoding.UTF8.GetString(memoryStream.ToArray()), &amp;quot;text/xml&amp;quot;, Encoding.UTF8);
    }
}
&lt;/pre&gt;
&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2315" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/XML/default.aspx">XML</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/MVC/default.aspx">MVC</category><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/LINQ/default.aspx">LINQ</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/24/xml-linq-requires-correct-namespace-for-all-xelements.aspx</feedburner:origLink></item><item><title>PDF SQL Server Cheat Sheet</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/CGLteVpFIAc/pdf-sql-server-cheat-sheet.aspx</link><pubDate>Wed, 20 May 2009 10:09:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2310</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2310</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/20/pdf-sql-server-cheat-sheet.aspx#comments</comments><description>&lt;p&gt;MVP &lt;a href="http://blog.sqlauthority.com" title="Pinal Dave"&gt;Pinal Dave&lt;/a&gt; has posted his &lt;a href="http://blog.sqlauthority.com/2009/05/20/sql-server-download-pdf-sql-server-cheat-sheet/%20" title="SQL Server cheat sheet"&gt;SQL Server cheat sheet&lt;/a&gt; as a PDF download.&lt;br /&gt;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2310" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/SQL/default.aspx">SQL</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/20/pdf-sql-server-cheat-sheet.aspx</feedburner:origLink></item><item><title>My Phone public beta opens</title><link>http://feedproxy.google.com/~r/DamienMcGivern/~3/nNwTORmm-zA/my-phone-public-beta-opens.aspx</link><pubDate>Tue, 19 May 2009 11:19:00 GMT</pubDate><guid isPermaLink="false">61b722dd-0c8a-41f4-a893-0fca5b7be9f7:2309</guid><dc:creator>Damien McGivern</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://nimtug.org/blogs/damien-mcgivern/rsscomments.aspx?PostID=2309</wfw:commentRss><comments>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/19/my-phone-public-beta-opens.aspx#comments</comments><description>&lt;p&gt;Microsoft has opened the beta of the My Phone service to the public. Only Windows Mobile phones with version 6 and up are supported.&lt;/p&gt;&lt;p&gt;It allows you to backup you data and access it from you My Phone web account and &lt;a href="http://sn1-p1.myphone.microsoft.com/mkweb//MoreInfo.po?tsid=1242731919587" title="All features of Microsoft My Phone"&gt;more&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://myphone.microsoft.com/%20" title="Microsoft My Phone"&gt;Microsoft My Phone&lt;/a&gt; &lt;br /&gt;&lt;/p&gt;&lt;img src="http://nimtug.org/aggbug.aspx?PostID=2309" width="1" height="1"&gt;</description><category domain="http://nimtug.org/blogs/damien-mcgivern/archive/tags/Windows+Mobile/default.aspx">Windows Mobile</category><feedburner:origLink>http://nimtug.org/blogs/damien-mcgivern/archive/2009/05/19/my-phone-public-beta-opens.aspx</feedburner:origLink></item></channel></rss>
