<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" 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/"><channel><title>Interakting Blogs</title><link>http://blogs.interakting.co.uk/MainFeed.aspx</link><description>Innovate. Interact. Inspire.</description><generator>Subtext Version 1.9.5.177</generator><item><title>Install EPiServer Composer on a SDK CMS Installation</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/06/30/install-episerver-composer-on-a-sdk-cms-installation.aspx</link><pubDate>Tue, 30 Jun 2009 07:06:37 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/06/30/install-episerver-composer-on-a-sdk-cms-installation.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/388.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/388.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/06/30/install-episerver-composer-on-a-sdk-cms-installation.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/388.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">Install EPiServer Composer on a SDK CMS Installation</source><description>&lt;p&gt;I’m sure that, like a lot of people working with EPiServer I have a play area that I use to try things out and start off any proof of concept work that I’m going to be implementing later on in  various projects.  For this, I use the &lt;a target="_blank" href="http://world.episerver.com/en/Download/Items/EPiServer-CMS/Version-5/EPiServer-CMS-5-R2-SP2/EPiServer-CMS-5-R2-SP2---SDK-Installation/"&gt;SDK Installation of EPiServer CMS&lt;/a&gt; along with an instance of the Visual Studio Web Server when my laptop boots up so that it’s always running.&lt;/p&gt;
&lt;p&gt;Today, I wanted to have a play with &lt;a target="_blank" href="http://www.episerver.com/en/Products/EPiServer-Composer/"&gt;Composer&lt;/a&gt; with a view to knowing enough about it to be able to get sign-off some projects that can use it.  First thing is just install it and see what happens.  There were some pretty good &lt;a target="_blank" href="http://world.episerver.com/en/Get-Started/Start-Developing-with-EPiServer-Composer/EPiServer-Composer-Fundamentals/EPiServer-Composer-Guides/#Create%20an%20EPiServer%20Composer%20content%20function"&gt;videos on the EPiServer site&lt;/a&gt; that give you basic tutorials on what to do once it was installed, but installing it is a minor stumbling block if you’re running the SDK, as your site it not hosted in IIS.  Cunningly, the EPiServer Deployment Center seems to look at sites in IIS and you don’t appear to have the ability to connect to a different web server (please, someone correct me if I am wrong).&lt;/p&gt;
&lt;p&gt;You can get past this little ‘glitch’ assuming that you have and instance of IIS installed locally and it’s pretty simple to get around if you follow the steps below:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Crack open the &lt;strong&gt;web.config&lt;/strong&gt; file of your SDK site.  Remove the port from the &lt;strong&gt;siteUrl&lt;/strong&gt;, &lt;strong&gt;uiUrl&lt;/strong&gt; and &lt;strong&gt;utilUrl&lt;/strong&gt; attributes in the &lt;strong&gt;siteSettings&lt;/strong&gt; element.  &lt;br /&gt;
    &lt;em&gt;More than likely the value is 6666, but note it down, as you will be putting it back later.&lt;/em&gt; &lt;/li&gt;
    &lt;li&gt;Open up IIS administration and create a new virtual directory with the same name as your SDK site.  Point thin new virtual directory at your SDK site installation folder and ensure that you create an application for it &lt;em&gt;(if not automatically done)&lt;/em&gt;. &lt;/li&gt;
    &lt;li&gt;IIS will now be able to server your site, but EPiServer will rightly inform you that you don’t have a license file.  Don’t worry too much about that, because we have no intention of really using IIS to serve the files and will be scurrying back to Visual Studio’s web server before too long. &lt;/li&gt;
    &lt;li&gt;Your next step is a potential setting change in the &lt;strong&gt;web.config&lt;/strong&gt; again.  Look for the &lt;strong&gt;virtualPathMappings&lt;/strong&gt; element (if there is one already) and make sure that the &lt;strong&gt;url&lt;/strong&gt; attribute starts ‘~/’.  I had a full URL in here, but this could well have been to a previous bungled attempt at doing this.  It’s worth checking and making sure it’s right.  If you cant find it, don’t worry. &lt;/li&gt;
    &lt;li&gt;From here, you should be able to open the EPiServer Deployment Centre and see your site.  Select the site and install the Composer, and click ‘Next’ a couple of times until the installation  is complete.  &lt;br /&gt;
    &lt;em&gt;After you have done this, maybe install the samples too for good measure – chances are you are about to have a play anyway.&lt;/em&gt; &lt;/li&gt;
    &lt;li&gt;Now that we have done that, we can reset the &lt;strong&gt;web.config&lt;/strong&gt; to use the Visual Studio in-built web server by putting the port numbers back in.  You can delete the IIS virtual directory at this point, or leave it there for later use, possibly with other EPiServer extension installations. &lt;/li&gt;
    &lt;li&gt;If you now look at your website in the Visual Studio solution explorer, click &lt;strong&gt;‘View All Files’&lt;/strong&gt; and add the ‘&lt;strong&gt;Composer’&lt;/strong&gt; and ‘&lt;strong&gt;Dropit’&lt;/strong&gt; folders to the project.  Also, a reference to each of the DropIt DLLs that now reside in your bin folder:
    &lt;ul&gt;
        &lt;li&gt;Dropit.ComponentArt.Web.UI.dll &lt;/li&gt;
        &lt;li&gt;Dropit.Extension.dll &lt;/li&gt;
        &lt;li&gt;Dropit.Extension.UI.dll &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;You should now be able to build your site without any problems, so cross you fingers and hit &amp;lt;CTRL&amp;gt;+&amp;lt;SHIFT&amp;gt;+&amp;lt;B&amp;gt;. &lt;/li&gt;
    &lt;li&gt;Assuming it all builds, your next step is to go and set up the &lt;strong&gt;Dropit.Extension&lt;/strong&gt; plug-in.  To do this, start your site and go to the &lt;strong&gt;Config&lt;/strong&gt; tab in the &lt;strong&gt;Admin &lt;/strong&gt;section.  Select &lt;strong&gt;Plug-in Manager&lt;/strong&gt; and edit the setting for &lt;strong&gt;Dropit.Extension&lt;/strong&gt;.  If the first property (‘&lt;em&gt;Set the page ID for the root Composer data container’&lt;/em&gt;) is not set, click the little button and select the &lt;strong&gt;[Extension data Container]&lt;/strong&gt;&lt;em&gt; &lt;/em&gt;page from the root of your site.  This should have been created during the installation of the Composer on your site. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That should be enough to get you running so that you can run through some of the &lt;a target="_blank" href="http://world.episerver.com/en/Get-Started/Start-Developing-with-EPiServer-Composer/EPiServer-Composer-Fundamentals/EPiServer-Composer-Guides/#Create%20an%20EPiServer%20Composer%20content%20function"&gt;sample videos on the EPiServer&lt;/a&gt; site and have a jolly good play.&lt;/p&gt;
&lt;p&gt;It’s worth noting that I was running around in circles with a simple error until some nice fellow on twitter told me to check this &lt;a target="_blank" href="http://world.episerver.com/en/Articles/Items/EPiServer-Composer---Best-Practices-for-Developers/"&gt;article that contains logging information for composer&lt;/a&gt; (thanks, Mr. Hellstrom).  It’s worth having on at least whilst you are getting to grips with it.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This is what i tried, although I suppose it is probably not en exact science, but it certainly should be a stab in the right direction.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/388.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>New location for blog</title><link>http://blogs.interakting.co.uk/steve/archive/2009/06/22/new-location-for-blog.aspx</link><pubDate>Mon, 22 Jun 2009 00:53:27 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/steve/archive/2009/06/22/new-location-for-blog.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/steve/comments/387.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/steve/comments/commentRss/387.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/steve/archive/2009/06/22/new-location-for-blog.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/steve/services/trackbacks/387.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/steve/rss.aspx">New location for blog</source><description>&lt;p&gt;I'll not be updating this blog anymore.  Instead, you can find my new blog at &lt;a href="http://stevehorsfield.wordpress.com"&gt;http://stevehorsfield.wordpress.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That blog will include both personal and business entries and is in no way representative of either Business &amp;amp; Decision or Interakting.  However, you will be able to find business, IT and other posts there.&lt;/p&gt;
&lt;p&gt;If you've found any of the posts on this blog useful, please update your links to my new blog.  Many thanks.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Stephen Horsfield&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/steve/aggbug/387.aspx" width="1" height="1" /&gt;</description><dc:creator>Stephen Horsfield</dc:creator></item><item><title>Poor EPiServer SDK</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/06/19/poor-episerver-sdk.aspx</link><pubDate>Fri, 19 Jun 2009 06:48:00 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/06/19/poor-episerver-sdk.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/386.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/386.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/06/19/poor-episerver-sdk.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/386.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">Poor EPiServer SDK</source><description>&lt;p&gt;Now that I get to use &lt;a rel="" href="http://www.episerver.com/" title="EPiServer"&gt;EPiServer&lt;/a&gt; CMS v5, I’m having approximately 165.3% more fun that I was with version 4.6.  I can actually find information about 5 easily on the internet, brilliant!  What I do find dismally disappointing though is the state of the SDK.  A great deal of it just lists methods or properties with no description.  In honesty, I can find out more using &lt;a target="_blank" href="http://www.red-gate.com/products/reflector/"&gt;reflector.net&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While I appreciate that the guys at &lt;a rel="" href="http://www.episerver.com/" title="EPiServer"&gt;EPiServer&lt;/a&gt; are doing some great work delivering a brilliant set of tools for us to work with, I can’t help but think that someone should be updating the &lt;a target="_blank" href="http://sdk.episerver.com/library/cms5/#"&gt;SDK&lt;/a&gt; with a little more vigor.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/386.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>Registering Page Event Handlers in EPiServer</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/06/18/registering-page-event-handlers-in-episerver.aspx</link><pubDate>Thu, 18 Jun 2009 08:04:50 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/06/18/registering-page-event-handlers-in-episerver.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/385.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/385.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/06/18/registering-page-event-handlers-in-episerver.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/385.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">Registering Page Event Handlers in EPiServer</source><description>&lt;p&gt;I’ve been working on a couple of things lately in &lt;a href="http://www.episerver.com/" rel="" title="EPiServer"&gt;EPiServer&lt;/a&gt; that I want to be able to easily re-use on other projects.  From my point of view that means just dropping DLLs in folders and letting &lt;a href="http://www.episerver.com/" rel="" title="EPiServer"&gt;EPiServer&lt;/a&gt; do as much of the work as possible.  One of my little pieces  of functionality needs to happen when a page has been published.  There are a couple of ways to do this, and previously I have been doing it in globla.ascx.  Today I cam across an blog by &lt;a href="http://labs.episerver.com/en/Blogs/Allan/" target="_blank"&gt;Allen Thraen&lt;/a&gt; on discussing the subject of &lt;a href="http://labs.episerver.com/en/Blogs/Allan/Dates/112230/3/When-and-Where-to-attach-DataFactory-Event-Handlers/" target="_blank"&gt;how to register DataFactory event handlers in EPiServer&lt;/a&gt; which describes in much better detail than I can about the different methods that can be used.&lt;/p&gt;
&lt;p&gt;I ended up using the last method he mentions as I find it the cleanest way forward.  I would copy the code in here, but you should go read his blog about it in honesty as its full of interesting stuff as always.  The key point is that any class that inherits from &lt;a href="http://sdk.episerver.com/library/cms5/html/N_EPiServer_PlugIn.htm" target="_blank"&gt;EPiServer.PlugIn&lt;/a&gt;.&lt;a href="http://sdk.episerver.com/library/cms5/html/T_EPiServer_PlugIn_PlugInAttribute.htm" target="_blank"&gt;PlugInAttribute&lt;/a&gt; and has a void Start() method will be called by &lt;a href="http://www.episerver.com/" rel="" title="EPiServer"&gt;EPiServer&lt;/a&gt; in the plug-in loading mechanism.&lt;/p&gt;
&lt;p&gt;The thing to keep in mind is that (as per Allen’s example code), if you register a &lt;a href="http://sdk.episerver.com/library/cms5/html/E_EPiServer_Core_PageStoreBase_PublishedPage.htm" target="_blank"&gt;PublishedEvent&lt;/a&gt; handler, it will happen when any page is published.  That being the case, you’ll need to be inventive with filtering your exact requirements in the event handler making sure that you only do what you want when you want to!  Common sense I suppose.  &lt;/p&gt;
&lt;p&gt;I then got to thinking, “Hey, if I can do this then how messy is this potentially going to get if anyone can register and event handler?”.  It would be pretty difficult to get a handle on what is going on.  Luckily, &lt;a href="http://labs.episerver.com/en/Blogs/Anders-Hattestad/" target="_blank"&gt;Andres Hattestad&lt;/a&gt; has got a solution for this that reports &lt;a href="http://labs.episerver.com/en/Blogs/Anders-Hattestad/Dates/2008/12/Page-events-what-events-are-registered/" target="_blank"&gt;which events are registered, and where&lt;/a&gt;.  I’m trying that out just now, but I’m pretty certain it’s going to be awesome and make my life a lot easier over the coming weeks, as I have a lot of plug-ins that I want to build.&lt;/p&gt;
&lt;p&gt;I strongly suggest that you going and read &lt;a href="http://labs.episerver.com/en/Blogs/Anders-Hattestad/Dates/2008/12/Page-events-what-events-are-registered/" target="_blank"&gt;Anders’s&lt;/a&gt; and &lt;a href="http://labs.episerver.com/en/Blogs/Allan/Dates/112230/3/When-and-Where-to-attach-DataFactory-Event-Handlers/" target="_blank"&gt;Allen’s&lt;/a&gt; posts and adorn them with due praise for being clever and of a sharing nature :)&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/385.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>ASP.Net: Consuming RSS Feeds MK II</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/06/12/asp.net-consuming-rss-feeds-mk-ii.aspx</link><pubDate>Fri, 12 Jun 2009 06:51:53 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/06/12/asp.net-consuming-rss-feeds-mk-ii.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/384.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/384.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/06/12/asp.net-consuming-rss-feeds-mk-ii.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/384.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">ASP.Net: Consuming RSS Feeds MK II</source><description>&lt;p&gt;Bah, I just found a much quicker and much simpler way of reading RSS while reading &lt;a href="http://labs.episerver.com/en/Blogs/Mats-Hellstrom/" target="_blank"&gt;Mats Hellström’s&lt;/a&gt; blog article about &lt;a href="http://labs.episerver.com/en/Blogs/Mats-Hellstrom/Dates/2009/6/Aggregating-Feeds/" target="_blank"&gt;Aggregating Feeds&lt;/a&gt; on the &lt;a href="http://labs.episerver.com/en/Blogs/" target="_blank"&gt;EPiServer Blogs&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Mats is talking about taking multiple feeds and adding them together, I’m still really only interested in on.  The key point I took from his blog is the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.syndicationfeed.aspx" target="_blank"&gt;SyndicationFeed&lt;/a&gt; class and all of its pals from the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.aspx" target="_blank"&gt;System.ServiceModel.Syndication&lt;/a&gt; namespace.  This makes most (read that as all) of &lt;a href="http://blogs.interakting.co.uk/mattnield/archive/2009/06/09/asp.net-consuming-rss-feeds.aspx" target="_blank"&gt;my previous post on the subject&lt;/a&gt; pretty much irrelevant, as this is all nicely handled for us.&lt;/p&gt;  &lt;p&gt;The code blow shows how I might do somethign similar to the previous post using nicer code:&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel.Syndication;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml;&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; Using_Syndication_Feed&lt;/pre&gt;

  &lt;pre class="alt"&gt;{&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;

  &lt;pre class="alt"&gt;    {&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            SyndicationFeed rssFeed = SyndicationFeed.Load(&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    XmlReader.Create(&lt;span class="str"&gt;"http://www.planet-f1.com/rss/0,16039,3213,00.xml"&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;                    );&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;            Console.WriteLine(&lt;/pre&gt;

  &lt;pre class="alt"&gt;                String.Format(&lt;/pre&gt;

  &lt;pre&gt;                    &lt;span class="str"&gt;"{0} &amp;gt; {1}"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    rssFeed.Title.Text,&lt;/pre&gt;

  &lt;pre&gt;                    rssFeed.Links[0].Uri.AbsoluteUri&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    )&lt;/pre&gt;

  &lt;pre&gt;                );&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (SyndicationItem rssItem &lt;span class="kwrd"&gt;in&lt;/span&gt; rssFeed.Items.Take(10))&lt;/pre&gt;

  &lt;pre class="alt"&gt;            {&lt;/pre&gt;

  &lt;pre&gt;                Console.WriteLine(&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    String.Format(&lt;/pre&gt;

  &lt;pre&gt;                        &lt;span class="str"&gt;"{0} - [{1}]"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        rssItem.Title.Text,&lt;/pre&gt;

  &lt;pre&gt;                        rssItem.PublishDate.ToString(&lt;span class="str"&gt;"s"&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        )&lt;/pre&gt;

  &lt;pre&gt;                    );&lt;/pre&gt;

  &lt;pre class="alt"&gt;            }&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;            Console.ReadLine();&lt;/pre&gt;

  &lt;pre&gt;        }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    }&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;
&lt;/div&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/384.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>Windows 7 Without IE</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/06/12/windows-7-without-ie.aspx</link><pubDate>Fri, 12 Jun 2009 02:28:38 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/06/12/windows-7-without-ie.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/383.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/383.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/06/12/windows-7-without-ie.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/383.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">Windows 7 Without IE</source><description>&lt;p&gt;Having had a glimpse on the &lt;a href="http://news.bbc.co.uk" target="_blank"&gt;BBC&lt;/a&gt; this morning, it looks like &lt;a href="http://www.microsoft.com" target="_blank"&gt;Microsoft&lt;/a&gt; are intending to shift &lt;a href="http://news.bbc.co.uk/1/hi/technology/8096701.stm" target="_blank"&gt;Windows 7 without IE installed&lt;/a&gt; in Europe, it is now something users will have to go and download and install for themselves.  &lt;/p&gt;  &lt;p&gt;In general, it looks like they’re leaving it up to the hardware vendors to decide what is installed on the machine and what is not, but what happens when user pop out and buy a copy of &lt;a href="http://www.microsoft.com/windows/windows-7/" target="_blank"&gt;Windows 7&lt;/a&gt; themselves?  I assume that means that there will just be a link on the desktop to go and download the file, otherwise, I can’t quite see how your average user is going to get on the internet in the first place to go and find a web-browser to download!  On the other hand, I can’t see your average user popping out and buying a copy of &lt;a href="http://www.microsoft.com/windows/" target="_blank"&gt;Windows&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;What seems slightly risible to me is that &lt;a href="http://en.wikipedia.org/wiki/European_Union_Microsoft_antitrust_case" target="_blank"&gt;Microsoft get slapped around by the European Commission&lt;/a&gt; for bundling things in to their OS, and Apple later on use the bundling of &lt;a href="http://www.youtube.com/watch?v=ti62jvSTM3Q" target="_blank"&gt;pre-installed software in the OS as a selling point&lt;/a&gt; with &lt;a href="http://www.apple.com/ilife/" target="_blank"&gt;iLife&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Related Information:&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://news.cnet.com/8301-13860_3-10262630-56.html?tag=newsLeadStoriesArea.1" href="http://news.cnet.com/8301-13860_3-10262630-56.html?tag=newsLeadStoriesArea.1"&gt;http://news.cnet.com/8301-13860_3-10262630-56.html?tag=newsLeadStoriesArea.1&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a title="http://www.apple.com/ilife/" href="http://www.apple.com/ilife/"&gt;http://www.apple.com/ilife/&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/383.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>ASP.Net: Consuming RSS Feeds</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/06/09/asp.net-consuming-rss-feeds.aspx</link><pubDate>Tue, 09 Jun 2009 03:50:32 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/06/09/asp.net-consuming-rss-feeds.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/382.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/382.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/06/09/asp.net-consuming-rss-feeds.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/382.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">ASP.Net: Consuming RSS Feeds</source><description>&lt;p&gt;I was recently working on an &lt;a href="http://www.episerver.com/" target="_blank"&gt;EPiServer&lt;/a&gt; solution and the client wanted to include an RSS feed on certain pages of their site.  I though I would write out here how I consumed the feed.  You’ll want to add error handling etc in here, as this is as rough as a tramps beard whilst being enough for you to get the point.&lt;/p&gt;  &lt;p&gt;The first thing I had to do was to find out how RSS is structured.  After a little &lt;a href="http://www.google.co.uk/search?q=RSS+Structure&amp;amp;ie=utf-8&amp;amp;oe=utf-8&amp;amp;aq=t&amp;amp;rls=org.mozilla:en-US:official&amp;amp;client=firefox-a" target="_blank"&gt;Google&lt;/a&gt; search I found an article explaining &lt;a href="http://www.thesmallest.com/lessonettes/rssstructure.html" target="_blank"&gt;the structure of RSS&lt;/a&gt; in sufficient detail for me to continue.&lt;/p&gt;  &lt;p&gt;The first thing that I did was create a struck to contain the configuration that I wanted, fairly simple:&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="rem"&gt;/// RSS feed configuration.&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    [Serializable]&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;struct&lt;/span&gt; PropertyRssFeedData&lt;/pre&gt;

  &lt;pre&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; feedLocation;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; linkTitle;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; displayRssImage;&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; numberofItemstoDisplay;&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; FeedLocation { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.feedLocation; } set { &lt;span class="kwrd"&gt;this&lt;/span&gt;.feedLocation = &lt;span class="kwrd"&gt;value&lt;/span&gt;; } }&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; LinkTitle { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.linkTitle; } set { &lt;span class="kwrd"&gt;this&lt;/span&gt;.linkTitle = &lt;span class="kwrd"&gt;value&lt;/span&gt;; } }&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; DisplayRssImage { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.displayRssImage; } set { &lt;span class="kwrd"&gt;this&lt;/span&gt;.displayRssImage = &lt;span class="kwrd"&gt;value&lt;/span&gt;; } }&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; NumberofItemstoDisplay { get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.numberofItemstoDisplay; } set { &lt;span class="kwrd"&gt;this&lt;/span&gt;.numberofItemstoDisplay = &lt;span class="kwrd"&gt;value&lt;/span&gt;; } }&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; PropertyRssFeedData(&lt;span class="kwrd"&gt;string&lt;/span&gt; url, &lt;span class="kwrd"&gt;int&lt;/span&gt; numItems, &lt;span class="kwrd"&gt;bool&lt;/span&gt; linkTitle, &lt;span class="kwrd"&gt;bool&lt;/span&gt; rssIcon)&lt;/pre&gt;

  &lt;pre&gt;        {&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.feedLocation = url;&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.numberofItemstoDisplay = numItems;&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.linkTitle = linkTitle;&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.displayRssImage = rssIcon;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;An instance of this will be serialized/deserialized as versions of the page are edited/created in &lt;a title="EPiServer" href="http://www.episerver.com/" rel=""&gt;EPiServer&lt;/a&gt;.  Essentially I just use it to determine how to render my HTML that I will present to the end-user.  Actually reading the RSS is pretty straight forward (this is really being posted as a reminder for me, but might be useful for others).   The following code creates a simple HTML block to present our feed.&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="preproc"&gt;#region&lt;/span&gt; render links and things&lt;/pre&gt;

  &lt;pre&gt;internalData = DeserializeData((&lt;span class="kwrd"&gt;string&lt;/span&gt;)PropertyData.Value);&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="rem"&gt;// Go get the feed&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;XmlTextReader rssReader = &lt;span class="kwrd"&gt;new&lt;/span&gt; XmlTextReader(internalData.FeedLocation);&lt;/pre&gt;

  &lt;pre&gt;XmlDocument rssDoc = &lt;span class="kwrd"&gt;new&lt;/span&gt; XmlDocument();&lt;/pre&gt;

  &lt;pre class="alt"&gt;rssDoc.Load(rssReader);&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// Look for the &amp;lt;rss&amp;gt; tag&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;XmlNode nodeRss = rssDoc.SelectSingleNode(&lt;span class="str"&gt;"//rss"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;&lt;span class="rem"&gt;// ensure we have an RSS node before we continue&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (nodeRss != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;// OK, start creating controls&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    StringBuilder htmlResult = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;

  &lt;pre class="alt"&gt;    htmlResult.Append(&lt;span class="str"&gt;"&amp;lt;div id=\"rssFeed\"&amp;gt;"&lt;/span&gt; + Environment.NewLine);&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;// Look for the &amp;lt;channel&amp;gt; tag&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    XmlNode nodeChannel = nodeRss.SelectSingleNode(&lt;span class="str"&gt;"//channel"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="preproc"&gt;#region&lt;/span&gt; Feed title&lt;/pre&gt;

  &lt;pre class="alt"&gt;    htmlResult.Append(&lt;span class="str"&gt;"\t&amp;lt;div id=\"rssFeedTitle\"&amp;gt;"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (internalData.LinkTitle)&lt;/pre&gt;

  &lt;pre&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        htmlResult.AppendFormat(&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="str"&gt;"&amp;lt;a href=\"{0}\"&amp;gt;{1}&amp;lt;/a&amp;gt;"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;            nodeChannel[&lt;span class="str"&gt;"link"&lt;/span&gt;].InnerText,&lt;/pre&gt;

  &lt;pre&gt;            nodeChannel[&lt;span class="str"&gt;"title"&lt;/span&gt;].InnerText&lt;/pre&gt;

  &lt;pre class="alt"&gt;            ); &lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    {&lt;/pre&gt;

  &lt;pre class="alt"&gt;        htmlResult.Append(nodeChannel[&lt;span class="str"&gt;"title"&lt;/span&gt;].InnerText);&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    htmlResult.Append(&lt;span class="str"&gt;"&amp;lt;/div&amp;gt;"&lt;/span&gt; + Environment.NewLine);&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="preproc"&gt;#region&lt;/span&gt; items&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;// get the kiddies&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (nodeChannel != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;

  &lt;pre class="alt"&gt;    {&lt;/pre&gt;

  &lt;pre&gt;        XmlNodeList itemNodes = nodeChannel.SelectNodes(&lt;span class="str"&gt;"//item"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (itemNodes.Count &amp;gt; 0)&lt;/pre&gt;

  &lt;pre class="alt"&gt;        {&lt;/pre&gt;

  &lt;pre&gt;            htmlResult.Append(&lt;span class="str"&gt;"\t&amp;lt;ul&amp;gt;"&lt;/span&gt; + Environment.NewLine);&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="rem"&gt;// we only want to display the maximum set in the &lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;            &lt;span class="rem"&gt;// configuration (otherwise ofc, we coudl use foreach here&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; counter = 0; counter &amp;lt; internalData.NumberofItemstoDisplay; counter++)&lt;/pre&gt;

  &lt;pre class="alt"&gt;            {&lt;/pre&gt;

  &lt;pre&gt;                htmlResult.Append(&lt;span class="str"&gt;"\t\t&amp;lt;li&amp;gt;"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;                &lt;span class="rem"&gt;// Display the icon or not&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (internalData.DisplayRssImage)&lt;/pre&gt;

  &lt;pre&gt;                {&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    &lt;span class="rem"&gt;// TODO : find a better way of displaying this&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;                    htmlResult.AppendFormat(&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="str"&gt;"&amp;lt;a href=\"{0}\"&amp;gt;{1}&amp;lt;/a&amp;gt;"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;                        itemNodes[counter][&lt;span class="str"&gt;"link"&lt;/span&gt;].InnerText,&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        String.Format(&lt;/pre&gt;

  &lt;pre&gt;                            &lt;span class="str"&gt;"&amp;lt;img src=\"{0}\"&amp;gt;{1}"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            &lt;span class="str"&gt;"/rssIcon.gif"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;                            itemNodes[counter][&lt;span class="str"&gt;"title"&lt;/span&gt;].InnerText&lt;/pre&gt;

  &lt;pre class="alt"&gt;                            )&lt;/pre&gt;

  &lt;pre&gt;                        );&lt;/pre&gt;

  &lt;pre class="alt"&gt;                }&lt;/pre&gt;

  &lt;pre&gt;                &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                {&lt;/pre&gt;

  &lt;pre&gt;                    htmlResult.AppendFormat(&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        &lt;span class="str"&gt;"&amp;lt;a href=\"{0}\"&amp;gt;{1}&amp;lt;/a&amp;gt;"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;                        itemNodes[counter][&lt;span class="str"&gt;"link"&lt;/span&gt;].InnerText,&lt;/pre&gt;

  &lt;pre class="alt"&gt;                        itemNodes[counter][&lt;span class="str"&gt;"title"&lt;/span&gt;].InnerText&lt;/pre&gt;

  &lt;pre&gt;                        );&lt;/pre&gt;

  &lt;pre class="alt"&gt;                }&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;                htmlResult.Append(&lt;span class="str"&gt;"\t\t&amp;lt;/li&amp;gt;"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;            htmlResult.Append(&lt;span class="str"&gt;"\t&amp;lt;/ul&amp;gt;"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre class="alt"&gt;        }&lt;/pre&gt;

  &lt;pre&gt;    }&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;    Literal output = &lt;span class="kwrd"&gt;new&lt;/span&gt; Literal();&lt;/pre&gt;

  &lt;pre&gt;    output.Text = htmlResult.ToString();&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.Controls.Add(output);&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;{&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="rem"&gt;// NO RSS TAG&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;}&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;While I could write about creating the property in &lt;a title="EPiServer" href="http://www.episerver.com/" rel=""&gt;EPiServer&lt;/a&gt; and wrapping it up all nicely.  I’ll be honest, it’s just a PropertyString, so not worth worrying about.  Ye sits rough and not very good at the error handling (as I eluded to above), but this is the easy bit.  I now have to go and port this back to &lt;a title="EPiServer" href="http://www.episerver.com/" rel=""&gt;EPiServer&lt;/a&gt; CMS 4.6!&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/382.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>Developing with EPiServer</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/03/27/developing-with-episerver.aspx</link><pubDate>Fri, 27 Mar 2009 00:52:41 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/03/27/developing-with-episerver.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/381.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/381.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/03/27/developing-with-episerver.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/381.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">Developing with EPiServer</source><description>&lt;p&gt;I often get asked to provide a handy starting guide to new people joining the company/team.  It's pretty straight forward to find on the &lt;a href="http://world.episerver.com/" target="_blank"&gt;EPiServer World&lt;/a&gt; site if you look under the &lt;a href="http://world.episerver.com/en/Get-Started/" target="_blank"&gt;Get Started&lt;/a&gt; tab.&lt;/p&gt;
&lt;p&gt;Just follow the link to &lt;a href="http://world.episerver.com/en/Get-Started/Developing-with-EPiServer-CMS/" target="_blank"&gt;Start Developing with EPiServer CMS 5 R2&lt;/a&gt; for some articles explaining the basics and video presentations too.&lt;/p&gt;
&lt;p&gt;I would also recommend having a look at &lt;a href="http://www.episerver.com/en/Products/EPiServer-Relate-2/" target="_blank"&gt;Relate+&lt;/a&gt;, which is a great addition to &lt;a href="http://www.episerver.com/en/Products/EPiServer-CMS-5/" target="_blank"&gt;EPiServer CMS&lt;/a&gt; for building community-themed web sites.  Again, there is some useful documentation about this in the &lt;a href="http://world.episerver.com/en/Get-Started/" target="_blank"&gt;Get Started&lt;/a&gt; tab under &lt;a href="http://world.episerver.com/en/Get-Started/Start-Developing-with-EPiServer-Community-and-Relate-/" target="_blank"&gt;Start Developing with Relate+&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/381.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>EPiServer: The trust relationship between the primary domain and the trusted domain failed</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/03/25/episerver-the-trust-relationship-between-the-primary-domain-and-the.aspx</link><pubDate>Wed, 25 Mar 2009 02:07:56 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/03/25/episerver-the-trust-relationship-between-the-primary-domain-and-the.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/380.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/380.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/03/25/episerver-the-trust-relationship-between-the-primary-domain-and-the.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/380.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">EPiServer: The trust relationship between the primary domain and the trusted domain failed</source><description>&lt;p&gt;I'm still fairly new to &lt;a title="EPiServer" href="http://www.episerver.com/" rel=""&gt;EPiServer&lt;/a&gt;, so I'm going through the process of a great many rookie errors whilst taking over a site from someone with vastly more knowledge of the product than me.&lt;/p&gt;
&lt;p&gt;One issue I had recently was when I was creating a new stage server for a client so that they could test things out.  I went through a cobbled route of copying their live DB and live code and slapping them on to of a clean &lt;a title="EPiServer" href="http://www.episerver.com/" rel=""&gt;EPiServer&lt;/a&gt; install and hacking about in the web.config file to get it all working.  The in itself was a piece of cake.&lt;/p&gt;
&lt;p&gt;I started getting problems when the AD users could not connect tot he site.  I checked and rechecked the LDAP settings in the web.config and they were all correct.  After a quick look on &lt;a href="http://world.episerver.com" target="_blank"&gt;EPiServer World&lt;/a&gt;, I found an &lt;a href="http://world.episerver.com/en/FAQ/Items/The-trust-relationship-between-the-primary-domain-and-the-trusted-domain-failed/" target="_blank"&gt;FAQ explaining the problem&lt;/a&gt;, though I could not manage to get the workarounds to provide the goods.&lt;/p&gt;
&lt;p&gt;The problem is not caused by EPiServer, it is how the .Net framework deals with AD when it is not connected to the domain.  Now that I knew a little more about what the cause of the problem might be, I hit Google to try and find a resolution.  Eventually a came across &lt;a href="http://www.techsupportforum.com/microsoft-support/windows-nt-2000-2003-server-2008-server/169618-disconnecting-domain.html" target="_blank"&gt;this forum entry&lt;/a&gt; which gave a possible solution.  The long story short is that bay changing the Local Policy on the server and rebooting.&lt;/p&gt;
&lt;p&gt;To make the change, follow the steps below:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Go to '&lt;strong&gt;Local Security Policy&lt;/strong&gt;' on the server through the Administrative Tools.&lt;/li&gt;
    &lt;li&gt;Expand '&lt;strong&gt;Local Policies&lt;/strong&gt;' and then click on 'Security Options' to see the list of security policies.&lt;/li&gt;
    &lt;li&gt;Select the '&lt;strong&gt;Interactive Logon: Number of previous logons to cache&lt;/strong&gt;' policy.&lt;/li&gt;
    &lt;li&gt;In the properties, set the cache value to 0.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This stops the OS for caching user details between logins, forcing the server to connect to the domain.  After quick reboot, this fixes the problem.&lt;/p&gt;
&lt;h3&gt;Related Links&lt;/h3&gt;
&lt;p&gt;&lt;a title="http://world.episerver.com/en/FAQ/Items/The-trust-relationship-between-the-primary-domain-and-the-trusted-domain-failed/" href="http://world.episerver.com/en/FAQ/Items/The-trust-relationship-between-the-primary-domain-and-the-trusted-domain-failed/"&gt;http://world.episerver.com/en/FAQ/Items/The-trust-relationship-between-the-primary-domain-and-the-trusted-domain-failed/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.techsupportforum.com/microsoft-support/windows-nt-2000-2003-server-2008-server/169618-disconnecting-domain.html" href="http://www.techsupportforum.com/microsoft-support/windows-nt-2000-2003-server-2008-server/169618-disconnecting-domain.html"&gt;http://www.techsupportforum.com/microsoft-support/windows-nt-2000-2003-server-2008-server/169618-disconnecting-domain.html&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/380.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>.Net: ...TableAdapter does not contain a definition for 'Connection'</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/03/17/.net-.tableadapter-does-not-contain-a-definition-for-connection.aspx</link><pubDate>Tue, 17 Mar 2009 13:14:11 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/03/17/.net-.tableadapter-does-not-contain-a-definition-for-connection.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/379.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/379.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/03/17/.net-.tableadapter-does-not-contain-a-definition-for-connection.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/379.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">.Net: ...TableAdapter does not contain a definition for 'Connection'</source><description>&lt;p&gt;When you are first playing with table adapters you might get to see.  When you create your typed data set, &lt;a title="Visual Studio" href="http://msdn.microsoft.com/vstudio/" target="_blank"&gt;Visual Studio&lt;/a&gt; will create an element in the generated XSD that contains the connection string that you were using.  This will more than likely not be the connection string that you want to use in your production environment.  So how do you go about changing it?  Well, if you start using the intellisense in &lt;a title="Visual Studio" href="http://msdn.microsoft.com/vstudio/" target="_blank"&gt;Visual Studio&lt;/a&gt;, you will soon find that there is a 'Connection' property on the table adapter once you have created it.  &lt;/p&gt;  &lt;p&gt;Great!  Lets set the connection string on that and well be done.  Ah, not so easy.  This will compile just fine, but as Connection is in fact an &lt;a href="http://msdn.microsoft.com/en-us/library/7c5ka91b.aspx" target="_blank"&gt;internal member&lt;/a&gt;, it is only available within the same assembly.  So if you are trying to access your data set from another assembly (which is often the case) you won't be able to set it.&lt;/p&gt;  &lt;p&gt;I've seen a number of people asking for a way to resolve this, and luckily the solution is simple and can be resolved by taking the following steps:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;In the design view of the dataset, select the table adapter that you want to change the connection for.     &lt;br /&gt;&lt;a href="http://blogs.interakting.co.uk/images/blogs_interakting_co_uk/mattnield/WindowsLiveWriter/.Ne.TableAdapterdoesnotcontainadefinitio_12A9D/TableAdapter_2.gif"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="339" alt="TableAdapter" src="http://blogs.interakting.co.uk/images/blogs_interakting_co_uk/mattnield/WindowsLiveWriter/.Ne.TableAdapterdoesnotcontainadefinitio_12A9D/TableAdapter_thumb.gif" width="255" border="0" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Open the properties of the Adapter (&amp;lt;F4&amp;gt; in &lt;a title="Visual Studio" href="http://msdn.microsoft.com/vstudio/" target="_blank"&gt;Visual Studio&lt;/a&gt;) and change the Connection Modifier property to public.     &lt;br /&gt;&lt;a href="http://blogs.interakting.co.uk/images/blogs_interakting_co_uk/mattnield/WindowsLiveWriter/.Ne.TableAdapterdoesnotcontainadefinitio_12A9D/Properties_2.gif"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="364" alt="Properties" src="http://blogs.interakting.co.uk/images/blogs_interakting_co_uk/mattnield/WindowsLiveWriter/.Ne.TableAdapterdoesnotcontainadefinitio_12A9D/Properties_thumb.gif" width="352" border="0" /&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;That should do it, you should then be able to use something like the following to change your connection:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; myNewConnectionString = &lt;span class="str"&gt;"Data Source=(local);Initial Catalog=MyStore;Integrated Security=True"&lt;/span&gt;;
TestDataSetTableAdapters.OrderTableAdapter ta = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataSetTests.TestDataSetTableAdapters.OrderTableAdapter();
ta.Connection.ConnectionString = myNewConnectionString;&lt;/pre&gt;

&lt;p&gt;Job done.&lt;/p&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/379.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>ASP.Net: &amp;quot;Could not load file or assembly 'App_Web_...&amp;quot;</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/03/17/asp.net-quotcould-not-load-file-or-assembly-app_web_.quot.aspx</link><pubDate>Tue, 17 Mar 2009 03:05:50 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/03/17/asp.net-quotcould-not-load-file-or-assembly-app_web_.quot.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/378.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/378.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/03/17/asp.net-quotcould-not-load-file-or-assembly-app_web_.quot.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/378.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">ASP.Net: &amp;quot;Could not load file or assembly 'App_Web_...&amp;quot;</source><description>&lt;p&gt;This was not the first time I've seen this error message in a web application.  Usually it happens on the development box and a quick re-compile gets rid of it quite easily.&lt;/p&gt;  &lt;p&gt;I had it today an a staging box, so re-compile is not an option.  Looking at the fairly obviously generated file name, it's clear that this file is part of the ASP.Net compilation process, so that was the general area to look for a solution.&lt;/p&gt;  &lt;p&gt;After a brief read about the &lt;a href="http://msdn.microsoft.com/en-us/library/s10awwz0.aspx" target="_blank"&gt;Compilation Element in the web.config&lt;/a&gt; file on the &lt;a href="http://msdn.microsoft.com/en-us/library/default.aspx" target="_blank"&gt;MSDN library&lt;/a&gt;, I made a brief edit to my web.config so that the &lt;strong&gt;batch&lt;/strong&gt; attribute is set to &lt;strong&gt;FALSE&lt;/strong&gt;.  This makes ASP.Net compile stuff as and when it needs it, rather than trying to compile everything when the application starts.  So now my web.config contains the following:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;compilation&lt;/span&gt; &lt;span class="attr"&gt;defaultLanguage&lt;/span&gt;&lt;span class="kwrd"&gt;="c#"&lt;/span&gt; &lt;span class="attr"&gt;debug&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;batch&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      ...
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;compilation&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    ...
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  ...
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;It looks like for some reason the compiler was getting confused while trying to compile the entire site.  Changing this setting makes it compile things when theya re first required and seems to get rid of the error.&lt;/p&gt;

&lt;p&gt;I've not managed to find a better solution or explanation from &lt;a title="Microsoft" href="http://www.microsoft.com" target="_blank"&gt;Microsoft&lt;/a&gt; about the issue, but it's gone away and that makes me happy.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/378.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>SQL Server: SQL 2008 Express Management Studio Download</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/03/13/sql-server-sql-2008-express-management-studio-download.aspx</link><pubDate>Fri, 13 Mar 2009 08:05:35 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/03/13/sql-server-sql-2008-express-management-studio-download.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/377.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/377.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/03/13/sql-server-sql-2008-express-management-studio-download.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/377.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">SQL Server: SQL 2008 Express Management Studio Download</source><description>&lt;p&gt;I've seen several posts today after an ex-colleague mentioned on their blog it not being easy to get the Management Studio for &lt;a href="http://www.microsoft.com/express/sql/default.aspx" target="_blank"&gt;SQL 2008 Express&lt;/a&gt; once you've installed the &lt;em&gt;engine only&lt;/em&gt; option of SQL Express.&lt;/p&gt;  &lt;p&gt;There is a method of upgrade that Dan details to &lt;a href="http://labs.episerver.com/en/Blogs/Dan-Matthews/Dates/2009/3/Dude-wherersquos-my-Management-Studio/" target="_blank"&gt;change the SQL 2008 Express version&lt;/a&gt;, but you can also &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b&amp;amp;displaylang=en" target="_blank"&gt;download the Management Studio from Microsoft&lt;/a&gt; directly without upgrading your instance.  You will need &lt;a href="http://www.microsoft.com/downloadS/details.aspx?familyid=5A58B56F-60B6-4412-95B9-54D056D6F9F4&amp;amp;displaylang=en" target="_blank"&gt;Windows Installer Version 4.5&lt;/a&gt; though :)&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/377.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>.Net: Getting the Currency Symbol from a Currency Code</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/03/13/.net-getting-the-currency-symbol-from-a-currency-code.aspx</link><pubDate>Fri, 13 Mar 2009 04:02:09 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/03/13/.net-getting-the-currency-symbol-from-a-currency-code.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/376.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/376.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/03/13/.net-getting-the-currency-symbol-from-a-currency-code.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/376.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">.Net: Getting the Currency Symbol from a Currency Code</source><description>&lt;p&gt;Many year ago I built an e-commerce solution where I was receiving the international currency code (I.e. GBP or USD) and had to use this to determine the currency symbol to display.  This was during the dirty days of ASP.Classic so I just slapped in a 'nice' little switch statement and that was that.&lt;/p&gt;  &lt;p&gt;That is neither elegant or good, and now faced with a similar issue I decided to look in to the problem and get a nicer solution.&lt;/p&gt;  &lt;h4&gt;The Problem&lt;/h4&gt;  &lt;p&gt;I'm receiving &lt;a href="http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes.htm" target="_blank"&gt;ISO 4217 currency codes&lt;/a&gt; in my application and that application in itself is running under a current culture of en-US.  &lt;/p&gt;  &lt;p&gt;Using this code, I need to determine the region or culture based information in order to display currencies to the end user.&lt;/p&gt;  &lt;h4&gt;The Solution&lt;/h4&gt;  &lt;p&gt;After a bit of looking about on the MSDN site at &lt;a href="http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo.aspx" target="_blank"&gt;RegionInfo&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx" target="_blank"&gt;CultureInfo&lt;/a&gt; I came up with the following &lt;a href="http://msdn.microsoft.com/en-us/vbasic/aa904594.aspx" target="_blank"&gt;LINQ&lt;/a&gt; query to return the &lt;a href="http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo.aspx" target="_blank"&gt;RegionInfo&lt;/a&gt;:&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; currencyCode = &lt;span class="str"&gt;"PLN"&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;System.Globalization.RegionInfo regionInfo = (&lt;/pre&gt;

  &lt;pre&gt;    from culture &lt;span class="kwrd"&gt;in&lt;/span&gt; System.Globalization.CultureInfo.GetCultures(&lt;/pre&gt;

  &lt;pre class="alt"&gt;        System.Globalization.CultureTypes.InstalledWin32Cultures&lt;/pre&gt;

  &lt;pre&gt;        )&lt;/pre&gt;

  &lt;pre class="alt"&gt;    let region = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Globalization.RegionInfo(culture.LCID)&lt;/pre&gt;

  &lt;pre&gt;    &lt;span class="kwrd"&gt;where&lt;/span&gt; String.Equals(&lt;/pre&gt;

  &lt;pre class="alt"&gt;        region.ISOCurrencySymbol, &lt;/pre&gt;

  &lt;pre&gt;        currencyCode, &lt;/pre&gt;

  &lt;pre class="alt"&gt;        StringComparison.InvariantCultureIgnoreCase&lt;/pre&gt;

  &lt;pre&gt;        )&lt;/pre&gt;

  &lt;pre class="alt"&gt;    select region).First();&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;Console.WriteLine(regionInfo.CurrencySymbol);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;Alternatively, we can return the &lt;a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx" target="_blank"&gt;CultureInfo&lt;/a&gt; itself and use String.Format to do the work for us.&lt;/p&gt;

&lt;div class="csharpcode"&gt;
  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; currencyCode = &lt;span class="str"&gt;"BRL"&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;decimal&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt; = 19.99M;&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;System.Globalization.CultureInfo cultureInfo = (&lt;/pre&gt;

  &lt;pre class="alt"&gt;    from culture &lt;span class="kwrd"&gt;in&lt;/span&gt; System.Globalization.CultureInfo.GetCultures(&lt;/pre&gt;

  &lt;pre&gt;        System.Globalization.CultureTypes.InstalledWin32Cultures&lt;/pre&gt;

  &lt;pre class="alt"&gt;        )&lt;/pre&gt;

  &lt;pre&gt;    let region = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Globalization.RegionInfo(culture.LCID)&lt;/pre&gt;

  &lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;where&lt;/span&gt; String.Equals(&lt;/pre&gt;

  &lt;pre&gt;        region.ISOCurrencySymbol, &lt;/pre&gt;

  &lt;pre class="alt"&gt;        currencyCode, &lt;/pre&gt;

  &lt;pre&gt;        StringComparison.InvariantCultureIgnoreCase&lt;/pre&gt;

  &lt;pre class="alt"&gt;        )&lt;/pre&gt;

  &lt;pre&gt;    select culture).First();&lt;/pre&gt;

  &lt;pre class="alt"&gt; &lt;/pre&gt;

  &lt;pre&gt;Console.WriteLine(&lt;/pre&gt;

  &lt;pre class="alt"&gt;    String.Format(&lt;/pre&gt;

  &lt;pre&gt;        cultureInfo,&lt;/pre&gt;

  &lt;pre class="alt"&gt;        &lt;span class="str"&gt;"{0:C}"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre&gt;        &lt;span class="kwrd"&gt;value&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;        )&lt;/pre&gt;

  &lt;pre&gt;    );&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;Job done.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/376.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>Pastures new...</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2009/02/09/pastures-new.aspx</link><pubDate>Mon, 09 Feb 2009 03:44:23 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2009/02/09/pastures-new.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/375.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/375.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2009/02/09/pastures-new.aspx#comment</comments><slash:comments>2</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/375.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">Pastures new...</source><description>&lt;p&gt;My time at Interakting / Business &amp;amp; Decision has come to an end and I am emigrating to South Africa in order to work with the EPiServer office in Cape Town. I'll make sure that all my blog posts here are kept up as long as possible, and be assured that once I've got myself sorted over there I'll carry on blogging directly on the &lt;a href="http://labs.episerver.com/en/Blogs"&gt;EPiServer Labs&lt;/a&gt; site.&lt;/p&gt;
&lt;p&gt;Until then - thanks for reading and, for the moment, this is me signing out!&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/375.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>ASP.Net: Downloading Files</title><link>http://blogs.interakting.co.uk/mattnield/archive/2009/01/30/asp.net-downloading-files.aspx</link><pubDate>Fri, 30 Jan 2009 08:52:49 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2009/01/30/asp.net-downloading-files.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/374.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/374.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2009/01/30/asp.net-downloading-files.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/374.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">ASP.Net: Downloading Files</source><description>&lt;p&gt;I was asked today how to go about downloading a file as a response to a server request.  I think last time I had to do that was in that days of ASP.&lt;em&gt;Classic&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;Anyhow, incase you are interested, the following code will allow you to download content through the browser and &lt;em&gt;should&lt;/em&gt; bring up the browser save dialogue.&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// Load a lovely file (yep - I'm not too concerned about permissions here) and&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="rem"&gt;// read it into a buffer&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;FileStream fs = &lt;span class="kwrd"&gt;new&lt;/span&gt; FileStream(&lt;span class="str"&gt;@"C:\TestXMLFile.xml"&lt;/span&gt;, FileMode.Open);&lt;/pre&gt;

  &lt;pre&gt;&lt;span class="kwrd"&gt;long&lt;/span&gt; fileSize = fs.Length;&lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;byte&lt;/span&gt;[] fileBuffer = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[Convert.ToInt32(fileSize)];&lt;/pre&gt;

  &lt;pre&gt;fs.Read(fileBuffer, 0, (&lt;span class="kwrd"&gt;int&lt;/span&gt;)fileSize);&lt;/pre&gt;

  &lt;pre class="alt"&gt;fs.Close();&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// Change the response headers&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;Response.ContentType = &lt;span class="str"&gt;"text/xml"&lt;/span&gt;;&lt;/pre&gt;

  &lt;pre class="alt"&gt;Response.AddHeader(&lt;span class="str"&gt;"content-disposition"&lt;/span&gt;, &lt;span class="str"&gt;"attachment; filename=myXmlFile.xml"&lt;/span&gt;);&lt;/pre&gt;

  &lt;pre&gt; &lt;/pre&gt;

  &lt;pre class="alt"&gt;&lt;span class="rem"&gt;// Write out the buffer&lt;/span&gt;&lt;/pre&gt;

  &lt;pre&gt;Response.BinaryWrite(fileBuffer);&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;

&lt;p&gt;The key part here is that we're changing the content type and the disposition header telling the client browser what it's expecting and what to do.  You can find more information on the &lt;a title="Microsoft" href="http://www.microsoft.com" target="_blank"&gt;Microsoft&lt;/a&gt; support site knowledge base: &lt;a href="http://support.microsoft.com/kb/260519" target="_blank"&gt;HOWTO: Raise a "File Download" Dialog Box for a Known MIME Type&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/374.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>Error 0x80070003 when installing an EPiServer Site</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2009/01/30/error-0x80070003-when-installing-an-episerver-site.aspx</link><pubDate>Fri, 30 Jan 2009 04:12:18 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2009/01/30/error-0x80070003-when-installing-an-episerver-site.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/373.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/373.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2009/01/30/error-0x80070003-when-installing-an-episerver-site.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/373.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">Error 0x80070003 when installing an EPiServer Site</source><description>&lt;p&gt;I was recently working with a client to deploy an EPiServer site and we came across a rather strange problem. The EPiServer Manager installed fine, but when I tried to set up a web site (with a database or not it doesn't matter) we were getting the following error reported:&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;System.InvalidOperationException: The installation failed, and the rollback has been performed. ---&amp;gt; System.IO.DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.PutEx(Int32 lnControlCode, String bstrName, Object vProp)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.DirectoryServices.PropertyValueCollection.OnClearComplete()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Collections.CollectionBase.Clear()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at EPiServer.Install.IIS6.DirectoryEntryExtension.SetValue(DirectoryEntry entry, String propertyName, String value)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at EPiServer.Install.IIS6.DirectoryEntryExtension.CreateSite(String siteName)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at EPiServer.Install.IIS6.Installers.NewWebAppInstaller.Install(IDictionary stateSaver)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   --- End of inner exception stack trace ---&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at EPiServer.Install.InstallationManager.DoInstall()Error - System.Management.Automation.CmdletInvocationException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003) ---&amp;gt; System.IO.DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at EPiServer.Install.InstallationManager.DoInstall()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at EPiServer.Install.InstallationManager.CommitBulkInstall()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at EPiServer.Install.Common.Cmdlets.CommitBulkInstallCmdlet.ProcessRecord()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Management.Automation.Cmdlet.DoProcessRecord()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Management.Automation.CommandProcessor.ProcessRecord()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   --- End of inner exception stack trace ---&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Management.Automation.Parser.PipelineNode.Execute(Array input, Pipe outputPipe, ArrayList&amp;amp; resultList)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New" color="#ff0000" size="2"&gt;   at System.Management.Automation.Parser.StatementListNode.Execute(Array input, Pipe outputPipe, ArrayList&amp;amp; resultList)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The last line that had worked before the error was thrown was 'Copied connectionStrings.config' and after some digging around it became apparent that the error was being thrown after the EPiServer Manager had finished copying files to the web site folder and when it was trying to create the actual web site in IIS. It was an extremely frustrating problem to track down and we tried security permissions and all sorts with no luck. There is a fair bit on the web about this error (default site missing in IIS and similar things like that) but nothing was helping.&lt;/p&gt;  &lt;p&gt;I was pretty sure it was not EPiServer itself at fault so I dug in the EPiServer and System.DirectoryServices assemblies with Reflector and figured out what was going on, then built a small test app in .Net. This also failed with exactly the same error... when .Net tried to access the IIS Metabase it was failing.&lt;/p&gt;  &lt;p&gt;Turns out that System.DirectoryServices uses COM Interop to clear and set values within the IIS Metabase. This is what was breaking. There is a way of manipulating them using AD-style classes and that seemed to work fine, so that meant it must be something up with the way .Net was talking to IIS via COM.&lt;/p&gt;  &lt;p&gt;The client helped out here because one of their technical guys on the server team had the brainwave of reinstalling Component Services. Hey presto, it worked - thanks Jeremy :) So if you have a similar problem, I suggest you try reinstalling COM and IIS first before getting serious with permissions and things.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/373.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>The EPiServer 'triangle'</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2009/01/16/the-episerver-triangle.aspx</link><pubDate>Fri, 16 Jan 2009 03:23:31 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2009/01/16/the-episerver-triangle.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/372.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/372.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2009/01/16/the-episerver-triangle.aspx#comment</comments><slash:comments>2</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/372.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">The EPiServer 'triangle'</source><description>&lt;p&gt;I've been thinking a bit about why EPiServer hits the 'sweet spot' for companies so nicely, and I think maybe the answer lies in its balance of feature coverage and market position. It knows where its strong point is - Content Management - but doesn't ignore the other areas. It also aims at the mid-market but is capable of scaling up or down, which is a sadly neglected approach. So many companies are being forced to choose between an self-declared 'Enterprise' solution or a self-confessed 'Entry Level' solution. Problem is, the Enterprise solutions are over-specified and over-priced for their needs, and the Entry Level solutions might meet the budget but don't meet the requirements. This can be summed up in this diagram:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.interakting.co.uk/images/blogs_interakting_co_uk/danmatthews/WindowsLiveWriter/TheEPiServertriangle_A033/The_EPiServer_Triangle_2.jpg"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="454" alt="The_EPiServer_Triangle" width="604" border="0" src="http://blogs.interakting.co.uk/images/blogs_interakting_co_uk/danmatthews/WindowsLiveWriter/TheEPiServertriangle_A033/The_EPiServer_Triangle_thumb.jpg" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;What do you think? Do you think this is a good summary or do you entirely disagree?&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/372.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>.Net: Controlling Math.Round()</title><link>http://blogs.interakting.co.uk/mattnield/archive/2008/12/17/.net-controlling-math.round.aspx</link><pubDate>Wed, 17 Dec 2008 04:41:26 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2008/12/17/.net-controlling-math.round.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/371.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/371.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2008/12/17/.net-controlling-math.round.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/371.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">.Net: Controlling Math.Round()</source><description>&lt;p&gt;Having recently been subject to a number of rounding issues in an application, we've had to take a closer look at how rounding works in the .Net framework.&lt;/p&gt;  &lt;p&gt;It seams that when using &lt;a href="http://msdn.microsoft.com/en-us/library/ms131275.aspx"&gt;Math.Round()&lt;/a&gt;, there is an overload that allows us to specify the type of rounding that is used in the form of the &lt;a href="http://msdn.microsoft.com/en-us/library/system.midpointrounding.aspx"&gt;MidpointRounding&lt;/a&gt; enumeration.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;As the &lt;a title="Microsoft" href="http://www.microsoft.com" target="_blank"&gt;Microsoft&lt;/a&gt; documentation will tell you, there are two possible values we can choose from:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;ToEven:&lt;/strong&gt; Round to the nearest even number. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;AwayFromZero:&lt;/strong&gt; Round to the nearest number &lt;u&gt;away from zero&lt;/u&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This proves to be quite interesting when you start thinking about it in a little more detail.  I was generally taught at school that you usually round up to the nearest number so that 0.5 becomes 1, -4.5 becomes for and so on.  This is not the case in .Net it would seem and I find it a little surprising that it has taken me this long to notice.&lt;/p&gt;  &lt;p&gt;If you write a little console application in &lt;a title="Visual Studio" href="http://msdn.microsoft.com/vstudio/" target="_blank"&gt;Visual Studio&lt;/a&gt;, you can take a look at how this works:&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;pre class="alt"&gt;            Console.WriteLine(&lt;/pre&gt;

  &lt;pre&gt;                &lt;span class="str"&gt;"Value   Default   Even   FromZero"&lt;/span&gt;&lt;/pre&gt;

  &lt;pre class="alt"&gt;                );&lt;/pre&gt;

  &lt;pre&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;decimal&lt;/span&gt; myValue = -2.0M; myValue &amp;lt; 2.0M; myValue += 0.1M)&lt;/pre&gt;

  &lt;pre class="alt"&gt;            {&lt;/pre&gt;

  &lt;pre&gt;                Console.WriteLine(String.Empty.PadLeft(35,&lt;span class="str"&gt;'-'&lt;/span&gt;));&lt;/pre&gt;

  &lt;pre class="alt"&gt;                Console.WriteLine(&lt;/pre&gt;

  &lt;pre&gt;                    &lt;span class="str"&gt;"{0}   {1}   {2}   {3}"&lt;/span&gt;,&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    myValue.ToString(&lt;span class="str"&gt;"0.0"&lt;/span&gt;).PadLeft(5),&lt;/pre&gt;

  &lt;pre&gt;                    Math.Round(myValue, 0).ToString(&lt;span class="str"&gt;"00"&lt;/span&gt;).PadLeft(7),&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    Math.Round(myValue, 0, MidpointRounding.AwayFromZero).ToString(&lt;span class="str"&gt;"00"&lt;/span&gt;).PadLeft(4),&lt;/pre&gt;

  &lt;pre&gt;                    Math.Round(myValue, 0, MidpointRounding.ToEven).ToString(&lt;span class="str"&gt;"00"&lt;/span&gt;).PadLeft(8)&lt;/pre&gt;

  &lt;pre class="alt"&gt;                    );&lt;/pre&gt;

  &lt;pre&gt;            }&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The following table give you an idea of how these work for some values.&lt;/p&gt;

&lt;table cellspacing="0" cellpadding="2" width="433" border="1"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="134"&gt;&lt;strong&gt;Value&lt;/strong&gt;&lt;/td&gt;

      &lt;td valign="top" width="140"&gt;&lt;strong&gt;Round to Even&lt;/strong&gt;&lt;/td&gt;

      &lt;td valign="top" width="157"&gt;&lt;strong&gt;Round Away from Zero&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="134"&gt;0.4&lt;/td&gt;

      &lt;td valign="top" width="140"&gt;0&lt;/td&gt;

      &lt;td valign="top" width="157"&gt;0&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="134"&gt;0.5&lt;/td&gt;

      &lt;td valign="top" width="140"&gt;0&lt;/td&gt;

      &lt;td valign="top" width="157"&gt;1&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="134"&gt;1.4&lt;/td&gt;

      &lt;td valign="top" width="140"&gt;1&lt;/td&gt;

      &lt;td valign="top" width="157"&gt;1&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="134"&gt;1.5&lt;/td&gt;

      &lt;td valign="top" width="140"&gt;2&lt;/td&gt;

      &lt;td valign="top" width="157"&gt;2&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The interesting point is that the default value for Math.Round when not specified is &lt;strong&gt;ToEven &lt;/strong&gt;which is not really what I would have expected.  I was also a little intrigued to find that there is not provision of a &lt;strong&gt;TowardsZero&lt;/strong&gt; value.  Having a look at &lt;a href="http://www.wikipedia.com"&gt;Wikipedia&lt;/a&gt;, there are numerous &lt;a href="http://en.wikipedia.org/wiki/Rounding"&gt;methods of rounding&lt;/a&gt; and they give a handy list of which languages make which preference.  .Net favors what Wikipedia calls '&lt;em&gt;Round-half-even&lt;/em&gt;', which is &lt;strong&gt;MidpointRounding.RoundToEven&lt;/strong&gt;.  It's sometimes refereed to as &lt;a href="http://www.diycalculator.com/sp-round.shtml#A5"&gt;Banker's Rounding&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This clearly is not a massive revelation, but when you start to deal with systems that need to perform calculations and correlate the results of those calculations with other, less-precise systems you should take note of how you will be rounding as checking this out early can prevent headaches later.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/371.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>Property Data Injection in EPiServer</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2008/12/09/property-data-injection-in-episerver.aspx</link><pubDate>Tue, 09 Dec 2008 04:42:03 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2008/12/09/property-data-injection-in-episerver.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/370.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/370.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2008/12/09/property-data-injection-in-episerver.aspx#comment</comments><slash:comments>5</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/370.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">Property Data Injection in EPiServer</source><description>&lt;p&gt;I am currently working on a project where it was necessary to conditionally inject some content into certain properties on some pages. Dynamic Content didn't really help me because what I wanted to do was replace entire properties with content from a property on another page and do it in a nice way for the editor. Linking the page with a shortcut to another page didn't help me because it needed to be only a partial replace and also conditional.&lt;/p&gt;
&lt;p&gt;Here's an example - and I know there are better ways to do this but I want an example that won't compromise the Intellectual Property of what I am actually doing :)&lt;/p&gt;
&lt;p&gt;Lets say you have a news article at &lt;a href="http://myepisite/News/SomeArticle"&gt;http://myepisite/News/SomeArticle&lt;/a&gt;. The article has a nice big image on it and you want to be able to swap the image out with a different one (lets forget the fact that you'd probably just do this with two properties). You have a sub-page storing the smaller image in a property at &lt;a href="http://myepisite/News/SomeArticle/LowImagery"&gt;http://myepisite/News/SomeArticle/LowImagery&lt;/a&gt;, which is hidden from the site. The way that you trigger the load of the low image is by URL QueryString, e.g. &lt;a href="http://myepisite/News/SomeArticle?bandwidth=lo"&gt;http://myepisite/News/SomeArticle?bandwidth=lo&lt;/a&gt;. (If you want some more tips on achieving this URL neatly, see my posts or other posts on URL rewriting.) Anyway, you could write a custom property type etc. to do this, but that's a fair whack of work and you'll need to create a new custom property for every content type that you might want to replace.&lt;/p&gt;
&lt;p&gt;So how do I achieve this in a neat, generic way? EPiServer provides a nice way, but it's not the most well documented route and neither do they really recommend it. Still, I think it can work well if properly implemented. The way I implemented to achieve this was using a custom Property Get Handler.&lt;/p&gt;
&lt;p&gt;When EPiServer asks for a page, it builds a PropertyDataCollection of all the properties on that page, along with their values. This PropertyDataCollection contains all the user-defined properties along with some that EPiServer add in as well such as PageLink, PageLanguageBranch and others. These are absolute lifesavers, although they are not well documented. The PropertyDataCollection has a default indexer which, when called, calls to a helper method to get the actual PropertyData for a property. The default helper method is a static method called 'DefaultPropertyHandler' on EPiServer.Core.PropertyGetHandler. This helper method looks for the the actual property data in four stages:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;It looks at the property on the current page and the current language &lt;/li&gt;
    &lt;li&gt;If that is empty, it checks to see whether the property is language specific and, if it is, whether the current language is the master language. If not, then it grabs the master language page and returns the value from that property. &lt;/li&gt;
    &lt;li&gt;If language isn't an issue, then it tries to get the property value from the linked page, if any. &lt;/li&gt;
    &lt;li&gt;If there is not data on a linked page, then it tries to return a dynamic property value with that property name. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This works well and is the default that probably fits 99% of EPiServer installations. However, EPiServer kindly allow us to replace this default Property Get Handler. All you need to do is write your own method that matches the delegate for the handler, and then set an EPiServer property like so:&lt;/p&gt;
&lt;p&gt;EPiServer.Core.PropertyDataCollection.GetHandler = new GetPropertyDelegate(Test.BandwidthPropertyGetHandler.BandwidthPropertyHandler); &lt;/p&gt;
&lt;p&gt;I'm sure you can set this in most places where you need it, but I just put it into the Application_Start of Global.asax.cs. So we can see how easy it is to override the property handling, but what does our custom method actually look like? The following code is incomplete, untested and partially commented out, but it should give the idea. The two parameters coming in are the property name being queried for data and the property data collection for the current page/language. Notice that rather than use the default indexer for properties, when asking for a property data value I am explicitly calling the 'Get' method - this prevents nasty infinite loops where my custom handler keeps calling itself.&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; Test
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; BandwidthPropertyGetHandler
    {
        &lt;span class="rem"&gt;// Methods&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; PropertyData BandwidthPropertyHandler(&lt;span class="kwrd"&gt;string&lt;/span&gt; name, &lt;br /&gt;						PropertyDataCollection properties)
        {
            &lt;span class="rem"&gt;// check querystring to see if we need to replace property (where possible)&lt;/span&gt;

            HttpRequest Request = System.Web.HttpContext.Current.Request;

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (Request.QueryString[&lt;span class="str"&gt;"bandwidth"&lt;/span&gt;] == &lt;span class="str"&gt;"lo"&lt;/span&gt;)
            {
                &lt;span class="rem"&gt;// we need to swap low bandwidth if it's the right property name&lt;/span&gt;
                &lt;span class="rem"&gt;// you could drive this any way you like - don't hardcode it in production :)&lt;/span&gt;

                &lt;span class="kwrd"&gt;if&lt;/span&gt; (name == &lt;span class="str"&gt;"ArticleImage"&lt;/span&gt;)
                {
                    &lt;span class="rem"&gt;// lets reach out and grab the data from the sub-page&lt;/span&gt;

                    PageReference ThisPageReference = (PageReference)properties.&lt;br /&gt;							Get(&lt;span class="str"&gt;"PageLink"&lt;/span&gt;).Value;

                    PageDataCollection ChildPages = EPiServer.DataFactory.Instance.&lt;br /&gt;			GetChildren(ThisPageReference, LanguageSelector.MasterLanguage());

                    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (PageData ChildPage &lt;span class="kwrd"&gt;in&lt;/span&gt; ChildPages)
                    {
                        &lt;span class="rem"&gt;// find an article subpage&lt;/span&gt;

                        &lt;span class="kwrd"&gt;if&lt;/span&gt; (ChildPage.PageTypeName.ToLower() == &lt;span class="str"&gt;"article subpage"&lt;/span&gt;)
                        {
                            &lt;span class="rem"&gt;// grab our property and return it&lt;/span&gt;

                            &lt;span class="kwrd"&gt;return&lt;/span&gt; ChildPage.Property.Get(&lt;span class="str"&gt;"ArticleImageLow"&lt;/span&gt;);
                        }
                    }
                }
            }

            &lt;span class="rem"&gt;// just return the default handler&lt;/span&gt;
            &lt;span class="kwrd"&gt;return&lt;/span&gt; PropertyGetHandler.DefaultPropertyHandler(name, properties);
        }
    }
}&lt;/pre&gt;
&lt;/blockquote&gt;&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;
&lt;p&gt;In my actual implementation I handle languages properly, error handling, null property values and all sorts of other things, but it should be fairly obvious how that would work. In essence, this is a very simple way of customising properties to make them do fairly clever things without customising property types themselves. In fact, this would be a nice way to retro-fit a feature such as bandwidth tailoring or other targeted content to an existing type. Just remember that if it's not a special case you should be handling, call the default handler to do it's stuff with that property! Also, it might be best to try to keep your injected property types the same as the property type on the owner page. Not sure what would happen if you messed with that.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/370.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>File Extensions and URL Rewriting in EPiServer</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2008/12/05/file-extensions-and-url-rewriting-in-episerver.aspx</link><pubDate>Fri, 05 Dec 2008 03:53:04 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2008/12/05/file-extensions-and-url-rewriting-in-episerver.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/369.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/369.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2008/12/05/file-extensions-and-url-rewriting-in-episerver.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/369.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">File Extensions and URL Rewriting in EPiServer</source><description>&lt;p&gt;I needed to throw together a quick geolocalisation demo for EPiServer v5 R2 the other day and to do that it was necessary to override some of the default URL rewriting behaviour of EPiServer. I knew it could be done, but I'd never actually had to write a custom URL provider before, so &lt;a href="http://labs.episerver.com/en/Blogs/Ted-Nyberg/Dates/112276/7/Implementing-a-custom-URL-rewrite-provider-for-EPiServer/"&gt;Ted Nyberg's blog post&lt;/a&gt; on rewriting in EPiServer gave me a good kick-start.&lt;/p&gt;
&lt;p&gt;My geolocalisation changes worked a treat (maybe I'll blog about that another time) but I did come across one really nasty 'feature' in EPiServer. I did find a workaround though, so I'll share it with you. Some background first though.&lt;/p&gt;
&lt;p&gt;As you may know, EPiServer has the nice ability to add a file extension on to pages. Before you rush off and try this out on your live site, be aware that it does change the default behaviour a little, for example it stops trailing slashes from working on the URL, e.g. this works:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://myepisite/SomePage/"&gt;http://myepisite/SomePage/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;...but this does not...&lt;/p&gt;
&lt;p&gt;&lt;a href="http://myepisite/SomePage.htm/"&gt;http://myepisite/SomePage.htm/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In fact, I like this feature because when using an external cache provider (such as Akamai), page extensions are A Good Thing as it knows how to treat them, and it also reduces the number of a URL 'possibilities' for a single page, so reducing the cache usage. As a bonus, it can also help with security as it slightly abstracts the page engine from the URL. Why not use the extension 'cfm' and then watch and laugh as all the ColdFusion-specific attacks roll in :)&lt;/p&gt;
&lt;p&gt;So I set an extension on my geolocalisation demo of '.htm' (done in the urlRewriteExtension property of the site settings element in Web.Config, make sure you put the dot in the extension as well otherwise you'll get SomePagehtm). So far, so good, and the out-the-box demo templates site appeared to run fine. But then I noticed a weird quirk. On the menu across the top, the various links made sense, for the most part:&lt;/p&gt;
&lt;p&gt;News -&amp;gt; &lt;a href="http://myepisite/en/News.htm"&gt;http://myepisite/en/News.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Events -&amp;gt; &lt;a href="http://myepisite/en/Events.htm"&gt;http://myepisite/en/Events.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and so on... but the Start link was all messed up:&lt;/p&gt;
&lt;p&gt;Start -&amp;gt; &lt;a href="http://myepisite/en.htm"&gt;http://myepisite/en.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What was strangest of all though was that this link actually worked! This made no sense on any level, and it was obvious that some internal fudge in the default URL rewriter was catching this as a special case. This was confirmed when I found &lt;a href="http://world.episerver.com/Forum/Pages/Thread.aspx?id=15768&amp;amp;epslanguage=en"&gt;this post from EPiServer support&lt;/a&gt;. They'd obviously found this 404'ing so built a special case for it.&lt;/p&gt;
&lt;p&gt;So why do I care? Because this breaks the URL model and breaks my geolocalisation scheme quite badly. That link should 404 or else I have an issue. Ideally, I want to actually write out the proper link. So I started digging. It turns out that you get a link like this when you have an EPiServer Start Page and ask for the LinkURL for it. The default URL rewriter seems to munge it up and spit out this crazy short URL rather than a nicely formatted link. This is the same for any language, for example the Swedish start page gives sv.htm. Ideally though, I would want it to write out something like this (the page is actually called Public in the English version):&lt;/p&gt;
&lt;p&gt;&lt;a href="http://myepisite/en/Public.htm"&gt;http://myepisite/en/Public.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I mean OK, it looks like any other page rather than a start page but surely that's better than en.htm! So... how do we go about getting the right page link rendered out and bypassing EPiServer's little 'fix'? Well, we can do it with the URL rewriter. I'll let Ted's post explain how to actually create the URL rewrite provider, but once you have the rewrite provider ready, you can override the ConvertToExternalInternal method as follows:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; ConvertToExternalInternal(UrlBuilder url, &lt;span class="kwrd"&gt;object&lt;/span&gt; internalObject, Encoding toEncoding)
{
    &lt;span class="rem"&gt;// apply default rewriting first&lt;/span&gt;
    &lt;span class="kwrd"&gt;bool&lt;/span&gt; bRewriteSuccess = &lt;span class="kwrd"&gt;base&lt;/span&gt;.ConvertToExternalInternal(url, internalObject, toEncoding);

    &lt;span class="kwrd"&gt;if&lt;/span&gt; (bRewriteSuccess)
    {
        &lt;span class="kwrd"&gt;string&lt;/span&gt;[] urlSplit = url.Path.Split(&lt;span class="str"&gt;'/'&lt;/span&gt;);
        
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (urlSplit.Length == 2)
        {
            &lt;span class="rem"&gt;// default page&lt;/span&gt;

            &lt;span class="kwrd"&gt;string&lt;/span&gt; DestinationCountryCode = urlSplit[1].Substring(0, 2);

            EPiServer.Core.PageData StartPage;

            &lt;span class="kwrd"&gt;try&lt;/span&gt;
            {
                StartPage = EPiServer.DataFactory.Instance.GetPage(&lt;br /&gt;&lt;span class="kwrd"&gt;	new&lt;/span&gt; EPiServer.Core.PageReference(EPiServer.Configuration.Settings.Instance.PageStartId), &lt;br /&gt;	&lt;span class="kwrd"&gt;new&lt;/span&gt; LanguageSelector(DestinationCountryCode));
            }
            &lt;span class="kwrd"&gt;catch&lt;/span&gt;
            {
                &lt;span class="rem"&gt;// no page with that language, just grab the link anyway and it will&lt;br /&gt;		 still work just with the current language name&lt;/span&gt;

                StartPage = EPiServer.DataFactory.Instance.GetPage(&lt;br /&gt;	&lt;span class="kwrd"&gt;new&lt;/span&gt; EPiServer.Core.PageReference(EPiServer.Configuration.Settings.Instance.PageStartId));
            }

            url.Path = &lt;span class="str"&gt;"/"&lt;/span&gt; + DestinationCountryCode + &lt;span class="str"&gt;"/"&lt;/span&gt; + StartPage.URLSegment + &lt;br /&gt;			EPiServer.Configuration.Settings.Instance.UrlRewriteExtension;
        }
    }
    
    &lt;span class="kwrd"&gt;return&lt;/span&gt; bRewriteSuccess;
}      &lt;/pre&gt;
&lt;style type="text/css"&gt;&lt;![CDATA[


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;This is not a fully-tested solution and it might need more work, but it shows that it is possible to fix this troublesome default behaviour. My geolocalisation demo then wrote out links as I would expect, and seemed to work perfectly across languages too. Hope this is of some use to anyone with similar issues even if it only gets you started on a fix!&lt;font face="Courier New"&gt;&lt;br /&gt;
&lt;/font&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/369.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>SQL Server: Great Scripts for Optimisation</title><link>http://blogs.interakting.co.uk/mattnield/archive/2008/12/02/sql-server-great-scripts-for-optimisation.aspx</link><pubDate>Tue, 02 Dec 2008 01:53:21 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2008/12/02/sql-server-great-scripts-for-optimisation.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/368.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/368.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2008/12/02/sql-server-great-scripts-for-optimisation.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/368.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">SQL Server: Great Scripts for Optimisation</source><description>A friend working at &lt;a href="http://www.graphico.co.uk"&gt;Graphico&lt;/a&gt; of my recently sent me some SQL that purposed to look for missing indexes in you databases.  It pretty much sat in my inbox for a while until I had time to look at it (which I have just done).&lt;br /&gt;
&lt;br /&gt;
It was a great little script and proved very useful in identifying performance improving indexes that we could include in the database that we're developing.  I asked my friend where the SQL was from and he pointed me to the article in question on the MSDN site, which you can find here:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://msdn.microsoft.com/en-us/magazine/cc135978.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/cc135978.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
It really is worth a read and has some very interesting stuff in it.  Cheers for that, Paul - most useful!&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/368.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>IE8 Beta 2 Bug: Disabled listboxes do not show selected items</title><link>http://blogs.interakting.co.uk/dominicz/archive/2008/11/27/ie8-beta-2-bug-disabled-listboxes-do-not-show-selected.aspx</link><pubDate>Thu, 27 Nov 2008 04:01:35 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/dominicz/archive/2008/11/27/ie8-beta-2-bug-disabled-listboxes-do-not-show-selected.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/dominicz/comments/367.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/dominicz/comments/commentRss/367.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/dominicz/archive/2008/11/27/ie8-beta-2-bug-disabled-listboxes-do-not-show-selected.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/dominicz/services/trackbacks/367.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/dominicz/rss.aspx">IE8 Beta 2 Bug: Disabled listboxes do not show selected items</source><description>&lt;p&gt;I've found a bug with IE8 Beta 2 (in both IE7 and IE8 browser modes) where list boxes that, although disabled but containing selected items, do not show the selected items. Here is an example of what should be displayed&lt;/p&gt;  &lt;select size="10" name="lstCon" multiple="multiple" disabled="disabled" id="lstCon"&gt; 		&lt;option selected="selected" value="S"&gt;I am selected&lt;/option&gt; 		&lt;option value="BN"&gt;Not selected&lt;/option&gt; 		&lt;option selected="selected" value="Z"&gt;I am selecting this as well!&lt;/option&gt; 		&lt;option value="BE"&gt;Not selected either&lt;/option&gt; 		&lt;option selected="selected" value="Z"&gt;I am selecting this too!&lt;/option&gt; 		&lt;option selected="selected" value="Z"&gt;I am selecting this again!&lt;/option&gt; 	&lt;/select&gt;  &lt;p&gt;For those of you who are not using IE8 Beta 2, here is what it appears like: &lt;/p&gt;  &lt;select size="10" name="lstCon" multiple="multiple" disabled="disabled" id="lstCon"&gt; 		&lt;option value="S"&gt;I am selected&lt;/option&gt; 		&lt;option value="BN"&gt;Not selected&lt;/option&gt; 		&lt;option value="Z"&gt;I am selecting this as well!&lt;/option&gt; 		&lt;option value="BE"&gt;Not selected either&lt;/option&gt; 		&lt;option value="Z"&gt;I am selecting this too!&lt;/option&gt; 		&lt;option value="Z"&gt;I am selecting this again!&lt;/option&gt; 	&lt;/select&gt;  &lt;p&gt;I have logged the bug on their forums at &lt;a href="http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.internetexplorer.beta&amp;amp;tid=55a9ace5-380d-408c-aa54-2d997de1f245&amp;amp;cat=〈=&amp;amp;cr=&amp;amp;sloc=&amp;amp;p=1"&gt;http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.internetexplorer.beta&amp;amp;tid=55a9ace5-380d-408c-aa54-2d997de1f245&amp;amp;cat=〈&amp;amp;cr=&amp;amp;sloc=&amp;amp;p=1&lt;/a&gt; so read and vote if you've found this to be a problem too! &lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/dominicz/aggbug/367.aspx" width="1" height="1" /&gt;</description><dc:creator>Dominic</dc:creator></item><item><title>WCF and EPiServer: Using WCF Web Programming Model Services in EPiServer sites on IIS 7</title><link>http://blogs.interakting.co.uk/steve/archive/2008/11/20/wcf-and-episerver-using-wcf-web-programming-model-services-in.aspx</link><pubDate>Thu, 20 Nov 2008 09:10:58 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/steve/archive/2008/11/20/wcf-and-episerver-using-wcf-web-programming-model-services-in.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/steve/comments/366.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/steve/comments/commentRss/366.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/steve/archive/2008/11/20/wcf-and-episerver-using-wcf-web-programming-model-services-in.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://blogs.interakting.co.uk/steve/services/trackbacks/366.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/steve/rss.aspx">WCF and EPiServer: Using WCF Web Programming Model Services in EPiServer sites on IIS 7</source><description>&lt;p&gt;I've just managed to get the &lt;a title="Microsoft .NET Framework" target="_blank" href="http://msdn2.microsoft.com/en-gb/netframework/default.aspx"&gt;.NET&lt;/a&gt; 3.5 style of WCF Web Programming Model services to work inside an &lt;a title="EPiServer Content Management System" target="_blank" href="http://www.episerver.com"&gt;EPiServer&lt;/a&gt; 5 R2 site on IIS 7 and Windows 2008.  I had a few difficulties finding out how to integrate the new model into IIS/ASP.NET and then further problems getting it working in EPiServer.  Here, I outline the solution.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I'm currently designing a site that will be using the Akamai Edge Suite of technologies (&lt;a href="http://www.akamai.com"&gt;www.akamai.com&lt;/a&gt;) and so I desire that all client access is through the caching layer.  Additionally, I'm motivated towards a REST model for web services to support a greater degree of caching.&lt;/p&gt;
&lt;p&gt;The new WCF Web Programming Model is ideal for this purpose as I can wrap service parameters directly into the URL and reduce the coding effort considerably.  I had been concerned about the integration of services into the same website as EPiServer because of how the URL mapping works in the Web Programming Model.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The solution is really easy once you realise that the typical EPiServer installation changes the default ASP.NET configuration.  Specifically, you may need the following:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Create a new folder to host your services &lt;/li&gt;
    &lt;li&gt;Create a small web.config in this folder (or use location tags in the main web.config file) and add service handlers &lt;/li&gt;
    &lt;li&gt;Create a ".svc" file for the service &lt;/li&gt;
    &lt;li&gt;Create the supporting .NET service code &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;u&gt;Create a new folder to host your services&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;This is necessary to allow a separate application configuration.  You can change the main application configuration at your own risk, however :)&lt;/p&gt;
&lt;p&gt;For the purposes of this post, I'll use "~/services/".&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Create a small web.config for this folder and add service handlers&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;You'll need to add the following:&lt;/p&gt;
&lt;div&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="UTF-8"&lt;/span&gt;?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.webServer&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;handlers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="svc-ISAPI"&lt;/span&gt; &lt;span class="attr"&gt;path&lt;/span&gt;&lt;span class="kwrd"&gt;="*.svc"&lt;/span&gt; &lt;span class="attr"&gt;verb&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="attr"&gt;modules&lt;/span&gt;&lt;span class="kwrd"&gt;="IsapiModule"&lt;/span&gt; 
           &lt;span class="attr"&gt;scriptProcessor&lt;/span&gt;&lt;span class="kwrd"&gt;="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"&lt;/span&gt;
           &lt;span class="attr"&gt;resourceType&lt;/span&gt;&lt;span class="kwrd"&gt;="Unspecified"&lt;/span&gt; 
           &lt;span class="attr"&gt;preCondition&lt;/span&gt;&lt;span class="kwrd"&gt;="classicMode,runtimeVersionv2.0,bitness32"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="ServiceHost"&lt;/span&gt; &lt;span class="attr"&gt;path&lt;/span&gt;&lt;span class="kwrd"&gt;="*.svc"&lt;/span&gt; &lt;span class="attr"&gt;verb&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;
           &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="System.ServiceModel.Activation.HttpHandler, System.ServiceModel,
                 Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&lt;/span&gt;
           &lt;span class="attr"&gt;resourceType&lt;/span&gt;&lt;span class="kwrd"&gt;="Unspecified"&lt;/span&gt; &lt;span class="attr"&gt;preCondition&lt;/span&gt;&lt;span class="kwrd"&gt;="integratedMode"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;handlers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.webServer&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Now I took this from a cleanly created website with no configuration (using the IIS management console) and I recommend that you do the same.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Create a ".svc" file for the service&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;This file is created in the service folder and forms part of the URL so name it accordingly.  I'll just use "service.svc" for illustration:&lt;/p&gt;
&lt;div&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="asp"&gt;&amp;lt;%@ ServiceHost Language="C#" Service="Service" CodeBehind="~/App_Code/service.cs"
    Factory="System.ServiceModel.Activation.WebServiceHostFactory" %&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You should name your services more appropriately, of course.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Create the supporting .NET service code&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;So, you need to create the classes.  Here, I'm using a simple file in the App_Code folder, but you might prefer to use a separate code project and assembly.  Here's a simple example:&lt;/p&gt;
&lt;div&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.ServiceModel.Web;

[ServiceContract]
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;interface&lt;/span&gt; IService
{
  [OperationContract]
  [WebGet(UriTemplate = &lt;span class="str"&gt;"test?s={s}"&lt;/span&gt;)]
  &lt;span class="kwrd"&gt;string&lt;/span&gt; test(&lt;span class="kwrd"&gt;string&lt;/span&gt; s);
}

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Service : IService
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; test(&lt;span class="kwrd"&gt;string&lt;/span&gt; s)
  {
    &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"test: "&lt;/span&gt; + s;
  }
}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;So, this is a very basic service with a single HTTP GET method that returns some data dependent on a single query string parameter.  A perfect REST example as the result is defined by the input, there is no change of state (so two identical GET requests result in the same value) and so the response is suitable for caching.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Using the service&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;So now, you can access the service as &lt;em&gt;http://your_episerver_site/services/service.svc/test?s=YourTestString&lt;/em&gt;.  ASP.NET integration (and IIS) requires the use of a service extension, in this case ".svc", however this article may help you to remove this issue: &lt;a title="http://blogs.msdn.com/bags/archive/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri.aspx" href="http://blogs.msdn.com/bags/archive/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri.aspx"&gt;http://blogs.msdn.com/bags/archive/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri.aspx&lt;/a&gt; but don't forget that EPiServer already does some URL rewriting and so you'll have to make sure they don't conflict!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Metadata&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Categories: ASP.NET, EPiServer, SOA, WCF, .NET, Windows Server &lt;/li&gt;
    &lt;li&gt;Keywords: Web Programming Model, Windows Communication Foundation, Service Oriented Architecture, AJAX, JSON &lt;/li&gt;
    &lt;li&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/software%20development"&gt;software development&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Windows%20Communication%20Foundation"&gt;Windows Communication Foundation&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/.NET"&gt;.NET&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/JSON"&gt;JSON&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/WCF"&gt;WCF&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/SOA"&gt;SOA&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/service%20design"&gt;service design&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/Service%20Oriented%20Architecture"&gt;Service Oriented Architecture&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/EPiServer"&gt;EPiServer&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/ASP.NET"&gt;ASP.NET&lt;/a&gt;, &lt;a rel="tag" href="http://technorati.com/tags/AJAX"&gt;AJAX&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://blogs.interakting.co.uk/steve/aggbug/366.aspx" width="1" height="1" /&gt;</description><dc:creator>Stephen Horsfield</dc:creator></item><item><title>Internet Explorer 8 (IE8) does not generate new Session IDs for new tabs and windows</title><link>http://blogs.interakting.co.uk/dominicz/archive/2008/11/20/internet-explorer-8-ie8-does-not-generate-new-session-ids.aspx</link><pubDate>Thu, 20 Nov 2008 01:15:31 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/dominicz/archive/2008/11/20/internet-explorer-8-ie8-does-not-generate-new-session-ids.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/dominicz/comments/365.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/dominicz/comments/commentRss/365.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/dominicz/archive/2008/11/20/internet-explorer-8-ie8-does-not-generate-new-session-ids.aspx#comment</comments><slash:comments>7</slash:comments><trackback:ping>http://blogs.interakting.co.uk/dominicz/services/trackbacks/365.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/dominicz/rss.aspx">Internet Explorer 8 (IE8) does not generate new Session IDs for new tabs and windows</source><description>&lt;p&gt;One of IE8's new features is a that when closing a window or tab, it can remember the session ID and therefore maintain the session with a website. This is an advantage if you accidentally close a window or tab, but there is a problem.&lt;/p&gt;  &lt;p&gt;For example, if you have several logins for a site, each login giving totally separate functionality of the site (e.g customer and administrator), then you may close your browser and login as someone else. What you &lt;em&gt;may&lt;/em&gt; find is that when you open a new window, you are already logged in as the other person. Why does this happen?&lt;/p&gt;  &lt;p&gt;IE8 seems to use the first window a storage mechanism for sites visited in this browsing session. When visiting a site, the unique Session ID is generated and then stored in this host process. When opening new tabs and windows the new process checks the host process to see if the website has been visited and if so returns the existing session ID.&lt;/p&gt;  &lt;p&gt;So to re-iterate, if you have at least 1 browser window open, all subsequent tabs and windows pointing to a specific site will all generate the same session ID.&lt;/p&gt;  &lt;p&gt;In order to get around this "problem", you should close all instances of IE8. The session information seems to be stored in memory rather than on disk, so by closing all of these instances, the problem goes away. &lt;/p&gt;  &lt;p&gt;This serves as a warning to both developers and kiosk/Internet café users. Developers should provide the ability to log out of a site so that the Session is cleaned up after a user logs out. Kiosk/Internet Café users should close ALL Internet browser sessions down before leaving!&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/dominicz/aggbug/365.aspx" width="1" height="1" /&gt;</description><dc:creator>Dominic</dc:creator></item><item><title>SecurityException when making requests to websites in Silverlight 2.0</title><link>http://blogs.interakting.co.uk/dominicz/archive/2008/11/17/securityexception-when-making-requests-to-websites-in-silverlight-2.0.aspx</link><pubDate>Mon, 17 Nov 2008 04:48:55 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/dominicz/archive/2008/11/17/securityexception-when-making-requests-to-websites-in-silverlight-2.0.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/dominicz/comments/363.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/dominicz/comments/commentRss/363.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/dominicz/archive/2008/11/17/securityexception-when-making-requests-to-websites-in-silverlight-2.0.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/dominicz/services/trackbacks/363.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/dominicz/rss.aspx">SecurityException when making requests to websites in Silverlight 2.0</source><description>&lt;p&gt;The 3 types of connections Silverlight can make are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Connections to web services and WCF services &lt;/li&gt;    &lt;li&gt;HTTP requests (via &lt;em&gt;HttpWebRequest&lt;/em&gt; and &lt;em&gt;WebClient&lt;/em&gt;) &lt;/li&gt;    &lt;li&gt;Raw data transfers &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;When building one of your early applications, you may choose to try out one of these classes to get back a really simple piece of HTML, purely to test the connection. For example:&lt;/p&gt;  &lt;div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, 'Courier New', courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px"&gt;   &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Button_Click(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)
{
    WebClient wc = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WebClient(&lt;span style="color: #006080"&gt;"http://www.google.com"&lt;/span&gt;);    
    wc.DownloadStringAsyncCompleted += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler&amp;lt;DownloadStringEventArgs&amp;gt;(wc_DownloadStringCompleted);    
    wc.DownloadStringAsync();
}

&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; wc_DownloadStringCompleted(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, DownloadStringEventArgs e)
{
    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(e.Error == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; e.Cancelled == &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;)  
    {        
        Debug.WriteLine(&lt;span style="color: #006080"&gt;"Data downloaded = "&lt;/span&gt; + e.Result);    
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;(N.B I apologise if this doesn't compile, I've just typed this by hand.)&lt;/p&gt;

&lt;p&gt;If you run this, you'll find it generates a &lt;em&gt;SecurityException&lt;/em&gt;, but why?&lt;/p&gt;

&lt;p&gt;To improve security, the only connections you can make without any security implications is &lt;em&gt;&lt;strong&gt;your own&lt;/strong&gt; website&lt;/em&gt;. If you want to call another website, Silverlight needs to check a few things. Firstly, it looks for a policy file called "clientaccesspolicy.xml", which is a file used by Adobe Flash to find out if it allows connections from Flash applications. If this file is missing, it then looks for "crossdomain.xml", which is a Silverlight version of this file.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;If one of these exists AND the policy file allows connections, then the application will be allowed to connect. &lt;/li&gt;

  &lt;li&gt;If neither exists, or the policy in an existing file denies access to the requested virtual directory, then a &lt;em&gt;SecurityException&lt;/em&gt; will be thrown by the application. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To overcome this problem, you have 2 options&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Check the website has an API to use the capabilities you are after. &lt;a target="_blank" href="http://code.google.com/apis/ajaxsearch/"&gt;Google&lt;/a&gt; and &lt;a target="_blank" href="http://apidoc.digg.com/"&gt;Digg&lt;/a&gt; have service APIs in order to allow applications to do this. &lt;/li&gt;

  &lt;li&gt;Write a web service (or WCF service), that does the enquiry for you. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you need to see the contents of these files, I have found &lt;a title="Microsoft Fiddler" target="_blank" href="http://www.fiddlertool.com"&gt;Fiddler&lt;/a&gt; an excellent tool for this purpose.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/dominicz/aggbug/363.aspx" width="1" height="1" /&gt;</description><dc:creator>Dominic</dc:creator></item><item><title>EPiCode Awards</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2008/11/17/epicode-awards.aspx</link><pubDate>Mon, 17 Nov 2008 04:35:04 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2008/11/17/epicode-awards.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/362.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/362.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2008/11/17/epicode-awards.aspx#comment</comments><slash:comments>1</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/362.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">EPiCode Awards</source><description>&lt;p&gt;EPiServer Norway are associated with an EPiServer community project called &lt;a href="https://www.coderesort.com/p/epicode"&gt;EPiCode&lt;/a&gt; which had its annual awards on the 12th of November as part of the Christmas Tech Forum. I was really pleased to see the Module of the Year award went to my pals over at &lt;a href="http://www.networkedplanet.com/"&gt;NetworkedPlanet&lt;/a&gt; for their &lt;a href="https://www.coderesort.com/p/epicode/wiki/EasySearch"&gt;EasySearch&lt;/a&gt; module. Unlike some of the other modules on EPiCode, it isn't free to use commercially - but it is free to download and try out and fills a nice gap in the EPiServer search space.&lt;/p&gt;
&lt;p&gt;A bunch of other 'active contributors' were lucky enough to get an iPod Shuffle in the awards - including me for contributing &lt;a href="https://www.coderesort.com/p/epicode/wiki/CloudCuckoo"&gt;CloudCuckoo&lt;/a&gt; and &lt;a href="https://www.coderesort.com/p/epicode/wiki/HyperThumbnail"&gt;HyperThumbnail&lt;/a&gt; on behalf of &lt;a href="http://www.interakting.co.uk"&gt;Interakting&lt;/a&gt;. Thank you EPiServer Norway!&lt;/p&gt;
&lt;p&gt;You can read more &lt;a href="https://www.coderesort.com/p/epicode/blog"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/362.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>Delayed Write Problem on $MFT and $Bitmap on an external hard disk</title><link>http://blogs.interakting.co.uk/dominicz/archive/2008/11/12/delayed-write-problem-on-mft-and-bitmap-on-an-external.aspx</link><pubDate>Wed, 12 Nov 2008 01:23:19 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/dominicz/archive/2008/11/12/delayed-write-problem-on-mft-and-bitmap-on-an-external.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/dominicz/comments/361.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/dominicz/comments/commentRss/361.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/dominicz/archive/2008/11/12/delayed-write-problem-on-mft-and-bitmap-on-an-external.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/dominicz/services/trackbacks/361.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/dominicz/rss.aspx">Delayed Write Problem on $MFT and $Bitmap on an external hard disk</source><description>&lt;p&gt;I put my VPC's on my external hard disk and run them off there, as the hard drive can run independently of Windows.&lt;/p&gt;  &lt;p&gt;I've noticed over the past few months, that randomly, my external USB 2.0 hard drive (Freecom 400GB) disconnects for no reason and I get a balloon in the system tray with the title "Delayed Write Problem" , then something to do with G:\$MFT or G:\$Bitmap. &lt;/p&gt;  &lt;p&gt;Yesterday, I was defragmenting my external hard disk and noticed it kept happening. I turned it off and on again, started defragmenting and the same problem happened.&lt;/p&gt;  &lt;p&gt;I thought it might be the writing caching, which helps improve performance, so when viewing the properties of the drive (My Computer -&amp;gt; [External Hard Disk] -&amp;gt; Right-click Properties -&amp;gt; Hardware -&amp;gt; Properties -&amp;gt; "Enable write caching on the disk"), I turned this option off.&lt;/p&gt;  &lt;p&gt;Another defragmentation session and the same problem happened again and again.&lt;/p&gt;  &lt;p&gt;What I finally realised was that I was using some software (DAEMON Tools Lite) for mounting ISO's to a CD drive. Although the software wasn't running, I still had the CD drive present in my drive listing. I loaded up DAEMON Tools Lite and turned off the emulated CD drive (which I wasn't using anyway) and HEY PRESTO! it was working.&lt;/p&gt;  &lt;p&gt;I defragmented half the drive and then turned write caching back on and it was fine!&lt;/p&gt;  &lt;p&gt;Hope this helps someone, as when a hard drive disconnects and a VPC is running off it, you are in trouble!&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/dominicz/aggbug/361.aspx" width="1" height="1" /&gt;</description><dc:creator>Dominic</dc:creator></item><item><title>EPiServer vs. Open Source</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2008/11/11/episerver-vs.-open-source.aspx</link><pubDate>Tue, 11 Nov 2008 02:58:05 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2008/11/11/episerver-vs.-open-source.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/360.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/360.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2008/11/11/episerver-vs.-open-source.aspx#comment</comments><slash:comments>3</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/360.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">EPiServer vs. Open Source</source><description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Interakting use both Open Source and proprietary products to deliver solutions for many companies. We always try to select the best tool for the job, and when it comes to Content Management it is no different. We have a range of tools we consider using including various Open Source tools (e.g. &lt;a href="http://www.nuxeo.com/"&gt;Nuxeo&lt;/a&gt;, &lt;a href="http://www.dotnetnuke.com/"&gt;DotNetNuke&lt;/a&gt;) and also our proprietary offerings (&lt;a href="http://www.episerver.com/"&gt;EPiServer&lt;/a&gt;, &lt;a href="http://www.adxstudio.com/"&gt;ADXSTUDIO&lt;/a&gt;). In the context of many projects it would certainly be possible to deliver a ‘successful’ project in either a proprietary or an Open Source solution. However, when we consider budgetary, functionality, deadline, support and longevity constraints, all of these areas are problematic in the Open Source arena, whereas proprietary systems such as EPiServer can provide an arguably better and more cost-effective solution. This article discusses some of the reasons for this. The majority of 'pure CMS' sites we deliver are on the EPiServer platform and so this will form the basis of our discussion. Interakting is an EPiServer Solution Partner.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Budgetary&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With a proprietary CMS such as EPiServer, the main costs are ‘up front’. The client would be buying a licence to use EPiServer CMS, and the cost of this covers the effort and time taken by the vendor to develop and support the product. This means that the vendor does not need to find other ways to recoup their costs beyond the licence fee and an optional small annual support fee. The client can therefore budget for the outright licence as a clearly transparent and defined cost.&lt;/p&gt;
&lt;p&gt;Open Source costs are far less clear, as companies who ‘own’ an Open Source initiative may give the software away ‘free’ but then seek to recoup their costs, even if only running costs. This is usually done by support contracts, consulting or selling additional ‘modules’. It is easy to be trapped into a ‘free’ product and then find that the actual cost is far higher.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Functionality&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As proprietary systems are designed to be sold as widely as possible to reach the maximum number of customers, functionality in proprietary systems is usually excellent and if additional functionality would assist their sales then the company owning the product will often update their core product or provide value-add modules at low or no cost. This is very much the case with EPiServer, who have grown rapidly due to their responsiveness to customer demands and now have many thousands of seats worldwide. The CMS is particularly user-friendly and intutitive and can be used by novice users without the need for costly training.&lt;/p&gt;
&lt;p&gt;In the Open Source arena this becomes more complex. The popular view is that the community ‘works together’ to build a product for the good of the community. This works well, to a point, but ultimately people are not entirely altruistic. Sooner or later (and sometimes always) they only contribute to things that benefit themselves. This means that the ‘out of the box’ product is often minimal functionality, and even if it is fairly well featured then those features are often not very flexible and designed for the use of the company that commissioned them with specific needs. It is unlikely the community will help add or update functionality and therefore it is left to the project team to do so, which can be fairly hard and time consuming. User training is likely to be required, particularly post deplyoment when users change jobs and new users need to work with the CMS. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Deadline&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As a general rule, any proprietary systems must be designed to provide a very rapid solution as this is a key selling point since the market is very competitive and unforgiving. In this regard EPiServer stands up very well which is one of the many reasons that Interakting has selected this tool. The well-featured out of the box nature of EPiServer, together with the well-documented and supported APIs, mean that a robust solution can be built rapidly and efficiently. The tools are built with the clients business needs clearly in mind as much as the developers.&lt;/p&gt;
&lt;p&gt;In an Open Source project, it has generally built by developers with a very code-centric approach. There is an expectation that the basic product will be customised by developers as needed, and the out-of-the-box functionality capability is usually minimal. Even with ‘starter’ kits for a particular tool, there is often a large amount of code and customisation to be done. Agencies promoting open source solutions capitalise on this aspect as it is very lucrative to develop the added functionality needed for more complex reqirements such as multi-lingual non-Latin support &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Support&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With EPiserver, as part of the licence agreement, the vendor undertakes to provide support and their reputation relies on this support being accessible and effective. The support is also usually rapid and efficient to respond with managed Help Desks staffed by knowledgeble individuals. They are able to respond with authority on support issues as they designed, wrote, maintain and own the codebase.&lt;/p&gt;
&lt;p&gt;For an Open Source tool, the support is either an expensive add-on from the company providing the tool or is community based. If a company is supporting a tool this is often not so much of a problem, although there is an issue that they are supporting code that they quite possibly did not write. From our experience (remember that we also work with Open Source solutions when we feel it appropriate), support from the community is often slow and inadequate for projects that have a critical path.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Longevity&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;EPiServer is committed to the products they sell and even if they discontinue a product will generally provide migration or upgrade paths. Generally speaking, it will also be clear in advance whether a product will be passing out of support and therefore a proper exit or migration strategy can be planned well in advance. EPiServer is also helpful in that, in the event of it ceasing to trade, it has made its code available to its licensees through an escrow arrangement at a nominal annual cost (although this is optional).&lt;/p&gt;
&lt;p&gt;Open Source projects are often left unfinished or unsupported once the community using them has moved onto something different. As a general rule, Open Source projects have a limited time in which they are actively updated and maintained and once a critical inactivity threshold is reached then they effectively become ‘legacy’, are taken into closed source or amalgamated into something larger. It can also be harder to plan an exit strategy as the ‘lifetime’ of a product is usually unclear.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In summary, we believe that for the many projects, the unknowns and variables involved in taking the Open Source route will result in a slightly higher initial cost of development and deployment and a significantly higher cost of ownership over a two year period following the initial go-live.&lt;/p&gt;
&lt;p&gt;By choosing to use a well-proven CMS which uses the .NET framework, a project is grounded on a solid, well defined and tightly costed product and the real cost of deployment and support over a 2-5 year lifetime can be estimated with a far higher degree of accuracy. Ongoing maintenance, functional enhancements and support will also be easier to define and budget. Finally, a large pool of .NET developers able to work with EPiServer and are readily available at competitive day rates meaning the client has total flexibility and would not be locked into any single supplier in the future.&lt;/p&gt;
&lt;p&gt;If you're looking for a CMS solution for your web site, &lt;a href="http://www.interakting.co.uk/en-gb/additional-menu/contact-us/"&gt;shouldn't we be talking&lt;/a&gt;?&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/360.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>WINWIN When Negotiating</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2008/10/16/winwin-when-negotiating.aspx</link><pubDate>Thu, 16 Oct 2008 00:36:57 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2008/10/16/winwin-when-negotiating.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/358.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/358.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2008/10/16/winwin-when-negotiating.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/358.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">WINWIN When Negotiating</source><description>&lt;p&gt;Last night I was at a &lt;a href="http://www.bcs.org/server.php?show=nav.9223"&gt;BCS Young Professionals Group&lt;/a&gt; meeting at the BCS offices in Southampton Street, London. The meeting was part of a 'SkillCentre' series being run with the help of a consultant called Anthony Rees facilitating, and the subject last night was &lt;a href="SkillCentre: Negotiation Skills"&gt;'Negotiation Skills'&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The session itself was excellent, culminating in groups coming up with a simple mnemonic to remember some basic concepts for negotiating. The group I was in came up with the mnemonic 'winwin':&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;W&lt;/em&gt;hat&lt;/strong&gt; do you want&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;I&lt;/em&gt;nvestigate&lt;/strong&gt; feasibility&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;N&lt;/em&gt;ote &lt;/strong&gt;it down&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;W&lt;/em&gt;alk&lt;/strong&gt; in their shoes&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;I&lt;/em&gt;dentify &lt;/strong&gt;tactics&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;N&lt;/em&gt;egotiate!&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Another group came up with the 'winning' mnemonic of 'KPMG', which raised a chuckle. I'm not sure I can remember it exactly, but it went something like:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;K&lt;/em&gt;now&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;P&lt;/em&gt;repare&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;M&lt;/em&gt;aximum &lt;/strong&gt;(&amp;amp; minimum)&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;G&lt;/em&gt;oals&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Personally, I found it memorable but less useful. But that's probably just me being biased. Following the main session there was a chance to network over wine and nibbles which was just as valuable as the session itself. And kudos to the BCS for putting on a nice Chilean Merlot :)&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/358.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>Should I change my Session state to StateServer ?</title><link>http://blogs.interakting.co.uk/dominicz/archive/2008/10/09/should-i-change-my-session-state-to-stateserver.aspx</link><pubDate>Thu, 09 Oct 2008 05:35:11 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/dominicz/archive/2008/10/09/should-i-change-my-session-state-to-stateserver.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/dominicz/comments/357.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/dominicz/comments/commentRss/357.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/dominicz/archive/2008/10/09/should-i-change-my-session-state-to-stateserver.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/dominicz/services/trackbacks/357.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/dominicz/rss.aspx">Should I change my Session state to StateServer ?</source><description>&lt;p&gt;After various conversations on both internal and external projects, I’ve noticed that some of our web projects were being developed using a Session state called &lt;em&gt;InProc&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;InProc&lt;/em&gt; means In-Process, so IIS is hosting all of the &lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"&gt;Session[“Dom”] = “Idiot!”; &lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;variables. Now, if the web application eats up too much memory, IIS 6 and above can be configured to recycle the Application pool – a contained unit of web sites, in order to free up memory. This is good for IIS but baaaad news for your website, as everything in the Session is lost – that could be shopping basket, current order status, user details! InProc is a bit of a quick and nasty method of developing as it just does its job, assuming that you are not going to host this to a larger audience (over about 5 users).&lt;/p&gt;
&lt;p&gt;As I found out with any large project, nothing goes to plan, so, the best thing to do is to use &lt;em&gt;StateServer&lt;/em&gt; and not &lt;em&gt;InProc&lt;/em&gt; – but WHY?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;StateServer&lt;/em&gt; is a totally out-of-process service that runs on either the same web server or a different server entirely. Session data is saved to this service so if the AppPool recycles, you have no problems whatsoever. Also, the data needs to serialize properly in order for it to be saved to the service.&lt;/p&gt;
&lt;p&gt;Whats the point I hear you ask? Well, the point is that if you use InProc and your application gets load balanced (often without your knowledge), the website won’t work properly. Remember, load balancing is decided, by either the hardware or the software, to help manage the network traffic to a destination server. So 1 request to go to Server1 and another or Server2, or even ServerX! Youch! So your site’s Session could be stored on another machine.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;StateServer&lt;/em&gt; works because all of the web.config’s point to the same machine, so they all work off that one service.&lt;/p&gt;
&lt;p&gt;The other option is &lt;em&gt;SQLServer&lt;/em&gt;, which stores it in SQL Server, which is more for web farms (multiple physical PCs), rather than web gardens (multiple virtualized PCs). Or you can use &lt;em&gt;Custom&lt;/em&gt; for a custom implementation (e.g ODBC or XML), or &lt;em&gt;Off&lt;/em&gt; to turn it off completely.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;Therefore, a good recommendation is to always change your web.config to say:&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;sessionState&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;mode&lt;/span&gt;=”&lt;span style="color: rgb(255, 0, 0);"&gt;StateServer&lt;/span&gt;” … &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And start the ASP.NET State Service on your machine. This way to can always revert to &lt;em&gt;InProc&lt;/em&gt; if you need to, but you are still ready for the switch over.&lt;/p&gt;
&lt;p&gt;Believe me, it’s a lot easier to start out this way, rather than have to work backwards.&lt;/p&gt;
&lt;p&gt;It is always a worthwhile exercise!&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/dominicz/aggbug/357.aspx" width="1" height="1" /&gt;</description><dc:creator>Dominic</dc:creator></item><item><title>Creating objects that know when they have changed - using IsDirty and custom PropertyChangedEvent's</title><link>http://blogs.interakting.co.uk/dominicz/archive/2008/10/09/creating-objects-that-know-when-they-have-changed---using.aspx</link><pubDate>Thu, 09 Oct 2008 01:57:57 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/dominicz/archive/2008/10/09/creating-objects-that-know-when-they-have-changed---using.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/dominicz/comments/356.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/dominicz/comments/commentRss/356.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/dominicz/archive/2008/10/09/creating-objects-that-know-when-they-have-changed---using.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/dominicz/services/trackbacks/356.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/dominicz/rss.aspx">Creating objects that know when they have changed - using IsDirty and custom PropertyChangedEvent's</source><description>&lt;p&gt;When working on a project recently, the data saved back to the database was huge. We are talking well over 100 properties. After talking to my Java buddy, he said that one way is to create an IsDirty method that returns if the object has changed state.&lt;/p&gt;  &lt;p&gt;The IsDirty() method is used to query the state of an object - if it has been modified or not. The implementation is up to the developer, but ultimately it's use can save you a trip to the data source.&lt;/p&gt;  &lt;p&gt;I have split this example into 3 stages:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;First attempt &lt;/li&gt;    &lt;li&gt;Refactored &lt;/li&gt;    &lt;li&gt;Event Handled &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;N.B. This article helps someone in (archaic) .NET 2.0 - but if you've looking to develop for .NET 3.5, it might be worth looking into DependencyProperty's, which caters for this sort of problem.&lt;/p&gt;  &lt;h2&gt;First Attempt&lt;/h2&gt;  &lt;p&gt;The problem I found when prototyping this is that it can be quite impractical at first glance:&lt;/p&gt;  &lt;div&gt;   &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Customer
{
    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; firstName, surname;
    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Customer(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; firstName, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; surname)
    {
        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.firstName = firstName;
        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.surname = surname;
    }

    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; FirstName
    {
        get { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; firstName; }
        set 
        { 
            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;( firstName != &lt;span style="color: #0000ff"&gt;value&lt;/span&gt; )
            {
                IsDirty = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;
                firstName = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;
            }
        }
    }
    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Surname
    {
        get { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; surname; }
        set 
        { 
            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;( surname != &lt;span style="color: #0000ff"&gt;value&lt;/span&gt; )
            {
                IsDirty = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;
                surname = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;
            }
        }
    }

    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; IsDirty { get; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; set; }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This is a bit bloated. Also, it relies on every property having to check for itself whether it is equal or not, setting the IsDirty property and also assigning the value.&lt;/p&gt;

&lt;p&gt;After writing this and implementing a few more properties I found this to be a bit too impractical. Instead, I realised that they are all basically doing 3 steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Checking the previous value to the new value. &lt;/li&gt;

  &lt;li&gt;Setting IsDirty. &lt;/li&gt;

  &lt;li&gt;Assigning the new value. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This example needs simplifying - or refactoring to be more precise.&lt;/p&gt;

&lt;h2&gt;Refactoring&lt;/h2&gt;

&lt;p&gt;Instead, I decided to implement this behaviour in a method called SetValue&amp;lt;T&amp;gt;() , which would raise events when a property has changed. This allows the IsDirty property to be changed centrally and debugging to be centralized. &lt;/p&gt;

&lt;p&gt;Firsty I created the method:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; SetValue&amp;lt;T&amp;gt;(&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt; T varName, T &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)
{
    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (varName.Equals(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;))
        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt;;
    
    IsDirty = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;
    varName = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Now, we can change our properties to:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; FirstName
{
    get {&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; firstName; }
    set
    {
        SetValue&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;(ref firstName,&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;);
    }
}

&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Surname
{
    get {&lt;span style="color: #0000ff"&gt;return&lt;/span&gt; surname; }
    set
    {
        SetValue&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;(ref surname,&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;);
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt; This is one implementation of it, but I decided to extend it to event handling as well, so that even the outside world can be notified about what is changing.&lt;/p&gt;

&lt;h2&gt;Event Handling&lt;/h2&gt;

&lt;p&gt;I decided to also implement this is in a typical Microsoft fashion: OnPropertyChanging and OnPropertyChanged. &lt;/p&gt;

&lt;p&gt;In order to turn this into an event driven model I need to do a few things:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Create some event arguments describing what is being changed. &lt;/li&gt;

  &lt;li&gt;Add some event handlers to trigger a notification that they have been changed. &lt;/li&gt;

  &lt;li&gt;Trigger the events from within your code &lt;/li&gt;

  &lt;li&gt;(Optionally) wire up the events. &lt;/li&gt;

  &lt;li&gt;Trigger the events from within your code &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Create event arguments&lt;/h3&gt;

&lt;p&gt;Since I am using events, I want to create event arguments detailing what has changed. I have implemented this in 2 identical classes (and 1 base class). Here I have implemented a base class, and 2 classes which improve the clarity of the base class. I have chosen clarity over code bloat:&lt;/p&gt;

&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #008000"&gt;//Base class implementation&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; PropertyChangeEventArgs : EventArgs
{
    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; PropertyName { get; &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; set; }
    &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; Value { get; set; }

    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; PropertyChangeEventArgs(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; before)
    {
        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PropertyName = propertyName;
        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Value = before;
    }
}

&lt;span style="color: #008000"&gt;//Holds arguments before the proerty has changed&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; PropertyChangingEventArgs : PropertyChangeEventArgs
{
    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; ValueBeforeChange
    {
        get
        {
            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Value;
        }
    }

    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; PropertyChangingEventArgs(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; before) 
        : &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;(propertyName,before)
    {
    }
}

&lt;span style="color: #008000"&gt;//Holds arguments after the proerty has changed&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; PropertyChangedEventArgs : PropertyChangeEventArgs
{
    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; ValueAfterChange
    { 
        get 
        { 
            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Value; 
        } 
    }

    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; PropertyChangedEventArgs(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName, &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; after) 
        : &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;(propertyName, after)
    {
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;h3&gt;Create event handlers&lt;/h3&gt;

&lt;p&gt;Now implement some event handlers:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;event&lt;/span&gt; PropertyChangingEventHandler PropertyChanging;
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; PropertyChangingEventHandler(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; o, PropertyChangingEventArgs e);

&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;event&lt;/span&gt; PropertyChangedEventHandler PropertyChanged;
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; PropertyChangedEventHandler(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; o,PropertyChangedEventArgs e);&lt;/pre&gt;
&lt;/div&gt;

&lt;h3&gt;Trigger the events from within your code&lt;/h3&gt;

&lt;p&gt;Now I need to trigger these events from the SetValue&amp;lt;T&amp;gt;() method. I will also need to find out what property was called by this SetValue&amp;lt;T&amp;gt;() method.&lt;/p&gt;

&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; SetValue&amp;lt;T&amp;gt;(T varName, T &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)
{
       &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (varName.Equals(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;))
           &lt;span style="color: #0000ff"&gt;return&lt;/span&gt;;

       &lt;span style="color: #008000"&gt;//TODO: Find the property's name that is calling this method&lt;/span&gt;
       &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName = &lt;span style="color: #006080"&gt;"MyProperty"&lt;/span&gt;;

       &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (PropertyChanging != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
           OnPropertyChanging(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PropertyChangingEventArgs(propertyName, varName));

       varName = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;

       &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (PropertyChanged != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)
           OnPropertyChanged(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PropertyChangedEventArgs(propertyName, varName));
   }&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The last thing to do is to find the property that is calling this method. This can be done using Reflection, by looking up the call stack. By getting the previous "frame", we can deduce where this is being called from. In our case, this is called "set_FirstName". Remove the "set_" and we have our property name:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;StackTrace st = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StackTrace();
StackFrame current = st.GetFrame(1);
&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName = current.GetMethod().Name.Replace(&lt;span style="color: #006080"&gt;"set_"&lt;/span&gt;, &lt;span style="color: #006080"&gt;""&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;

&lt;h3&gt;(Optionally) wire up the events&lt;/h3&gt;

&lt;p&gt;I want to subscribe to the OnPropertyChanged event, so that I can set the IsDirty property within it. I have done this within a private constructor:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Customer()
{
   PropertyChanged += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; PropertyChangedEventHandler(OnPropertyChanged);
}

&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Customer(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; firstName, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; surname) : &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;()
{
   &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.firstName = firstName;
   &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.surname = surname;
}&lt;/pre&gt;
&lt;/div&gt;

&lt;h3&gt;(Optionally) trigger the events from within your code&lt;/h3&gt;

&lt;p&gt;Now, I want to move the IsDirty assignment out of the SetValue() method because although overkill, it is not related to the setting of the value. It is related to the &lt;em&gt;event &lt;/em&gt;but not the &lt;em&gt;assignment&lt;/em&gt;. It also means that you have just wasted 15 minutes reading this article! :-) :&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; OnPropertyChanged(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, PropertyChangedEventArgs ea)
{
   IsDirty = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;
}&lt;/pre&gt;
&lt;/div&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;So what have we done? We've looked at ways in which we can implement notification within a class, so that we can save a database access. When getting to a large number of properties, we can bypass each save and also allow the outside world to be notified of its changes.&lt;/p&gt;

&lt;p&gt;In the first example,we saw a cheap and nasty way of doing it, but impractical for larger classes. In the second example we saw a better implementation and in the third example we added event handling to extend the functionality further.&lt;/p&gt;

&lt;p&gt;I hope this article helps someone - but if you've looking to develop for .NET 3.5, it might be worth looking into DependencyProperty's, which caters for this sort of problem.&lt;/p&gt;

&lt;p&gt;Here is the full source code to have a play with:&lt;/p&gt;

&lt;div overflow="auto"&gt;
  &lt;pre&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Customer c = new Customer("Dominic", "Zukiewicz");
            c.FirstName = "Dommy dom dom";

            Console.WriteLine("Customer.IsDirty = " + c.IsDirty);

            Customer c2 = new Customer("Dominic", "Zukiewicz");
            c.Surname = "Zukiewicz";

            Console.WriteLine("Customer2.IsDirty = " + c2.IsDirty);
        }
    }

    class Customer
    {
        private string firstName;
        private string surname;

        private Customer()
        {
            PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);
        }

        public Customer(string firstName, string surname) : this()
        {
            this.firstName = firstName;
            this.surname = surname;
        }

        public string FirstName
        {
            get
            {
                return firstName;
            }
            set
            {
                SetValue&lt;string&gt;(ref firstName, value);
            }
        }

        public string Surname
        {
            get 
            { 
                return surname; 
            }
            set
            {
                SetValue&lt;string&gt;(ref surname,value);
            }
        }

        public bool IsDirty { get; private set; }


        private void SetValue&lt;t&gt;(T varName, T value)
        {
            if (varName.Equals(value))
                return;

            StackTrace st = new StackTrace();
            StackFrame current = st.GetFrame(1);
            string propertyName = current.GetMethod().Name.Replace("set_", "");

            if (PropertyChanging != null)
                OnPropertyChanging(this, new PropertyChangingEventArgs(propertyName, varName));

            varName = value;

            if (PropertyChanged != null)
                OnPropertyChanged(this, new PropertyChangedEventArgs(propertyName, varName));
        }

        public event PropertyChangingEventHandler PropertyChanging;
        public delegate void PropertyChangingEventHandler(object o, PropertyChangingEventArgs e);

        public event PropertyChangedEventHandler PropertyChanged;
        public delegate void PropertyChangedEventHandler(object o,PropertyChangedEventArgs e);

        private void OnPropertyChanged(object sender, PropertyChangedEventArgs ea)
        {
            Debug.Print("Property: {0}, After: {1}", ea.PropertyName, ea.ValueAfterChange);
            IsDirty = true;
        }

        private void OnPropertyChanging(object sender, PropertyChangingEventArgs ea)
        {
            Debug.Print("Property: {0}, Before: {1}", ea.PropertyName, ea.ValueBeforeChange);
        }
        
    }

    //Base class implementation
    public abstract class PropertyChangeEventArgs : EventArgs
    {
        public string PropertyName { get; protected set; }
        protected object Value { get; set; }

        public PropertyChangeEventArgs(string propertyName, object before)
        {
            this.PropertyName = propertyName;
            this.Value = before;
        }
    }

    //Holds arguments before the proerty has changed
    public class PropertyChangingEventArgs : PropertyChangeEventArgs
    {
        public object ValueBeforeChange
        {
            get
            {
                return this.Value;
            }
        }

        public PropertyChangingEventArgs(string propertyName, object before) 
            : base(propertyName,before)
        {
        }
    }

    //Holds arguments after the proerty has changed
    public class PropertyChangedEventArgs : PropertyChangeEventArgs
    {
        public object ValueAfterChange
        { 
            get 
            { 
                return this.Value; 
            } 
        }

        public PropertyChangedEventArgs(string propertyName, object after) 
            : base(propertyName, after)
        {
        }
    }
}&lt;/t&gt;&lt;/string&gt;&lt;/string&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;img src="http://blogs.interakting.co.uk/dominicz/aggbug/356.aspx" width="1" height="1" /&gt;</description><dc:creator>Dominic</dc:creator></item><item><title>Using Visual Studio 2005/2008 to easily insert column names into a stored procedure</title><link>http://blogs.interakting.co.uk/dominicz/archive/2008/10/08/using-visual-studio-20052008-to-easily-insert-column-names-into.aspx</link><pubDate>Wed, 08 Oct 2008 06:13:10 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/dominicz/archive/2008/10/08/using-visual-studio-20052008-to-easily-insert-column-names-into.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/dominicz/comments/355.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/dominicz/comments/commentRss/355.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/dominicz/archive/2008/10/08/using-visual-studio-20052008-to-easily-insert-column-names-into.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/dominicz/services/trackbacks/355.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/dominicz/rss.aspx">Using Visual Studio 2005/2008 to easily insert column names into a stored procedure</source><description>&lt;p&gt;When writing stored procedures or views, I always create them in Visual Studio (2005/2008) and then run them on a specified database. When using "SELECT *", it is compact, but obviously does not help you find the columns of the table or view.&lt;/p&gt;
&lt;p&gt;When using the IDE, I added a new SQL Script for Stored Procedures, and then I typed:&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;SELECT&lt;/span&gt; *&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;FROM&lt;/span&gt; Customers&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;and a blue box surrounded the statement. I right-clicked -&amp;gt; Design SQL Block.&lt;/p&gt;
&lt;p&gt;The designer then listed all of the column names for me, and when clicking OK, instantly put them back into the SQL script I was creating!&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: rgb(244, 244, 244);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;SELECT&lt;/span&gt;  CustomerID, CompanyName, ContactName, ContactTitle, &lt;br /&gt;        Address, City, Region, PostalCode, Country, Phone, Fax&lt;br /&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;FROM&lt;/span&gt;    Customers&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;For the table I was using, this list over 60 columns for me!&lt;/p&gt;
&lt;p&gt;So if you want a quick way of listing all of the column names for table of view:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Add a database project to your site (if you haven't already done so)&lt;/li&gt;
    &lt;li&gt;Right click Queries -&amp;gt; Add SQL Script&lt;/li&gt;
    &lt;li&gt;Choose Stored Procedure Script&lt;/li&gt;
    &lt;li&gt;Type your SELECT * From XYZ statement&lt;/li&gt;
    &lt;li&gt;Right click -&amp;gt; Design SQL Block&lt;/li&gt;
    &lt;li&gt;Click OK.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The designer will be updated with the new query.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/dominicz/aggbug/355.aspx" width="1" height="1" /&gt;</description><dc:creator>Dominic</dc:creator></item><item><title>BizTalk: Division Functiod Returns Double</title><link>http://blogs.interakting.co.uk/mattnield/archive/2008/10/01/biztalk-division-functiod-returns-double.aspx</link><pubDate>Wed, 01 Oct 2008 05:49:06 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2008/10/01/biztalk-division-functiod-returns-double.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/354.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/354.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2008/10/01/biztalk-division-functiod-returns-double.aspx#comment</comments><slash:comments>0</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/354.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">BizTalk: Division Functiod Returns Double</source><description>&lt;p&gt;Just a little note here that we noticed testing something (how it had not occurred before, I do not know).  We have a function that we were referencing from a referenced assembly that would format values to the slightly odd format being used by the ERP that we were talking too.  In  most cases it seamed to work OK, but for smaller values it didn't quite product the result we expected.&lt;/p&gt;  &lt;p&gt;It turns out that the result of the Division functiod in &lt;a title="BizTalk Server" href="http://www.microsoft.com/biztalk/default.mspx" target="_blank"&gt;BizTalk Server&lt;/a&gt; 2006 is a double.  The mapper being the way it is converts this to a string (assumably using .ToString()).  At least this is how it looks when I point &lt;a title="ILDASM Reference" href="http://msdn.microsoft.com/en-us/library/f7dy01k1(VS.80).aspx"&gt;ildasm.exe&lt;/a&gt; at &lt;a title="Microsoft" href="http://www.microsoft.com" target="_blank"&gt;Microsoft&lt;/a&gt;.BizTalk.BaseFunctoids.dll.&lt;/p&gt;  &lt;p&gt;Now, rather simply put, I was being a fool and trying to convert this to a decimal and wondering what was going on.  I was passing what I though was a value of "0.00002" to my referenced method and expecting it to be formatted properly.  When we looked deeper in to the issue, we noticed that the value coming out was in fact "2E-05", which is how a float or a double would represent the value 0.00002.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Quick use of the &lt;a title="Double.TryParse()" href="http://msdn.microsoft.com/en-us/library/system.double.tryparse.aspx"&gt;double.TryParse()&lt;/a&gt; fixes this issue and off we trundle.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;Worth keeping in mind, and also worth having a look at the base functoids using ildasm.exe when relying on their output.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/354.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item><item><title>Syncing Outlook with a Windows Mobile device in Vista</title><link>http://blogs.interakting.co.uk/danmatthews/archive/2008/10/01/syncing-outlook-with-a-windows-mobile-device-in-vista.aspx</link><pubDate>Wed, 01 Oct 2008 00:37:39 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/danmatthews/archive/2008/10/01/syncing-outlook-with-a-windows-mobile-device-in-vista.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/danmatthews/comments/353.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/danmatthews/comments/commentRss/353.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/danmatthews/archive/2008/10/01/syncing-outlook-with-a-windows-mobile-device-in-vista.aspx#comment</comments><slash:comments>2</slash:comments><trackback:ping>http://blogs.interakting.co.uk/danmatthews/services/trackbacks/353.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/danmatthews/rss.aspx">Syncing Outlook with a Windows Mobile device in Vista</source><description>&lt;p&gt;My XP laptop had ground to a halt - 6 months without a rebuild and it had got so clogged that it literally took 5 minutes just to boot. I needed to wipe it and start again but the head of our technical team offered me a fresh laptop with a clean Vista Business build. Deciding that being a guinea pig was a nice idea, I accepted it. The 4 gig of ram (up from 2 gig) was the sweetener that made up my mind for sure :)&lt;/p&gt;  &lt;p&gt;As I was setting it up just how I wanted it, one of the things I needed to do was sync my two mobile phones with it. I have both an HTC 4350 (Herald) from work and my own personal HTC TyTN II. On my XP laptop I used ActiveSync to sync up my calendar, tasks and contacts.&lt;/p&gt;  &lt;p&gt;Knowing that ActiveSync has been replaced on Vista, I was hoping for an easy experience. After plugging in my TyTN II, Vista offered to sync my media files. Fine, but I wanted to sync with Outlook so I cancelled the dialog and started my hunt. In Control Panel I found 'Sync Centre' which offered to sync my media files again. This was getting annoying. Contacts and/or Outlook were mentioned nowhere.&lt;/p&gt;  &lt;p&gt;Maybe the 'Windows Mobile Device Centre' in Control Panel was my best bet? Nope. That just had settings on whether I wanted to connect via USB and Bluetooth or not. Nothing about syncing. Googling didn't help me that much. There doesn't seem to be much info about this. Is it that obvious? Am I missing something?&lt;/p&gt;  &lt;p&gt;Actually, I was missing something. The latest download of &lt;a href="http://www.microsoft.com/windowsmobile/en-us/help/synchronize/device-center.mspx"&gt;Windows Mobile Device Centre&lt;/a&gt; (currently 6.1 as I write). This is basically what ActiveSync used to be, and syncs up all the bits and pieces you'd expect with Outlook. In fact, it's very smart and clean and appears to be a nice improvement on ActiveSync.&lt;/p&gt;  &lt;p&gt;I thought it worth blogging this for two reasons. Firstly, hopefully this will get indexed so that it can be a quick help to others who were in the same boat as me. Secondly, is this part of the problem with Vista? It's not exactly intuitive that you have to install an updated version of a Control Panel applet to be able to sync (although behind the scenes it's more than that, of course). It almost seems that the out-the-box install is half baked. And the help isn't much help.&lt;/p&gt;  &lt;p&gt;It's possible that I still missed a trick, of course, and if I have done then please feel free to comment here and set me straight!&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/danmatthews/aggbug/353.aspx" width="1" height="1" /&gt;</description><dc:creator>Dan Matthews</dc:creator></item><item><title>Silverlight: System.Net.WebClient Returns &amp;quot;Security error&amp;quot;</title><link>http://blogs.interakting.co.uk/mattnield/archive/2008/09/19/silverlight-system.net.webclient-returns-quotsecurity-errorquot.aspx</link><pubDate>Fri, 19 Sep 2008 06:47:24 GMT</pubDate><guid isPermaLink="true">http://blogs.interakting.co.uk/mattnield/archive/2008/09/19/silverlight-system.net.webclient-returns-quotsecurity-errorquot.aspx</guid><wfw:comment>http://blogs.interakting.co.uk/mattnield/comments/352.aspx</wfw:comment><wfw:commentRss>http://blogs.interakting.co.uk/mattnield/comments/commentRss/352.aspx</wfw:commentRss><comments>http://blogs.interakting.co.uk/mattnield/archive/2008/09/19/silverlight-system.net.webclient-returns-quotsecurity-errorquot.aspx#comment</comments><slash:comments>2</slash:comments><trackback:ping>http://blogs.interakting.co.uk/mattnield/services/trackbacks/352.aspx</trackback:ping><source url="http://blogs.interakting.co.uk/mattnield/rss.aspx">Silverlight: System.Net.WebClient Returns &amp;quot;Security error&amp;quot;</source><description>&lt;p&gt;When trying to access remote content in &lt;a title="Microsoft Silverlight" href="http://silverlight.net/" rel="" target="_blank"&gt;Silverlight&lt;/a&gt;, you need to add a &lt;a title="How to: Make a Service Available Across Domain Boundaries" href="http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx"&gt;clientaccespolicy.xml file&lt;/a&gt; to the root of the web server that you are trying to access.  I did this, my file looked like this:&lt;/p&gt;  &lt;div class="csharpcode-wrapper"&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;access-policy&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;cross-domain-access&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;policy&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;allow-from&lt;/span&gt; &lt;span class="attr"&gt;http-request-headers&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;domain&lt;/span&gt; &lt;span class="attr"&gt;uri&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;allow-from&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;grant-to&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;resource&lt;/span&gt; &lt;span class="attr"&gt;include-subpaths&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;path&lt;/span&gt;&lt;span class="kwrd"&gt;="/"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;grant-to&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;policy&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;cross-domain-access&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;access-policy&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;So essentially, anyone can access this.&lt;/p&gt;

&lt;p&gt;I wrote my code to retrieve the information in a C# console app, just to test it out the WebClient as follows:&lt;/p&gt;

&lt;div class="csharpcode-wrapper"&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.IO;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Net;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml;
&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml.Linq;

&lt;span class="kwrd"&gt;namespace&lt;/span&gt; GetBlogContentTest
{
    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program
    {
        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
        {
            WebClient w = &lt;span class="kwrd"&gt;new&lt;/span&gt; WebClient();

            &lt;span class="kwrd"&gt;string&lt;/span&gt; result = w.DownloadString(&lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;"http://blogs.interakting.co.uk/MainFeed.aspx"&lt;/span&gt;));
            
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(result))
            {
                XDocument xDoc = XDocument.Parse(result, LoadOptions.SetBaseUri);

                var blogItems = from item &lt;span class="kwrd"&gt;in&lt;/span&gt; xDoc.Descendants(&lt;span class="str"&gt;"item"&lt;/span&gt;)
                                select &lt;span class="kwrd"&gt;new&lt;/span&gt; ChannelItem
                                {
                                    Title = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)item.Element(&lt;span class="str"&gt;"title"&lt;/span&gt;),
                                    Link = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)item.Element(&lt;span class="str"&gt;"link"&lt;/span&gt;),
                                    PubDate = (DateTime)item.Element(&lt;span class="str"&gt;"pubDate"&lt;/span&gt;),
                                    SourceUrl = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)item.Element(&lt;span class="str"&gt;"source"&lt;/span&gt;).Attribute(&lt;span class="str"&gt;"url"&lt;/span&gt;),
                                    Description = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)item.Element(&lt;span class="str"&gt;"description"&lt;/span&gt;),
                                    Author = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)item.Element(XName.Get(&lt;span class="str"&gt;"creator"&lt;/span&gt;,&lt;span class="str"&gt;"http://purl.org/dc/elements/1.1/"&lt;/span&gt;))
                                };

                &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ChannelItem item &lt;span class="kwrd"&gt;in&lt;/span&gt; blogItems)
                {
                    Console.WriteLine(&lt;span class="str"&gt;"Title: {0}"&lt;/span&gt;, item.Title);
                    Console.WriteLine(&lt;span class="str"&gt;"Link : {0}"&lt;/span&gt;, item.Link);
                    Console.WriteLine(&lt;span class="str"&gt;"SUrl : {0}"&lt;/span&gt;, item.SourceUrl);
                    Console.WriteLine(&lt;span class="str"&gt;"Auth : {0}"&lt;/span&gt;, item.Author);
                    Console.WriteLine(&lt;span class="str"&gt;"Date : {0}"&lt;/span&gt;, item.PubDate);
                    Console.WriteLine(&lt;span class="str"&gt;"Content Length: {0}{1}"&lt;/span&gt;, item.Description.Length, Environment.NewLine);
                }

            }
            &lt;span class="kwrd"&gt;else&lt;/span&gt;
            {
                Console.WriteLine(&lt;span class="str"&gt;"No Results Retrieved"&lt;/span&gt;);
            }

            Console.ReadLine();
        }
    }
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This also, worked fine.  &lt;strong&gt;However&lt;/strong&gt;, when I put the same code in to my shiny new &lt;a title="Microsoft Silverlight" href="http://silverlight.net/" rel="" target="_blank"&gt;Silverlight&lt;/a&gt; application and run it through debug I get myself a nice little error.  The error message itself is a little bit on the ambiguous as we sometimes come to expect from technologies in their infancy.  Essentially the error I got was "&lt;em&gt;Security error&lt;/em&gt;".  Gee, thanks for that?!&lt;/p&gt;

&lt;p&gt;Digging a  little deeper in tot eh actual exception, we get the stack etc and the actual error (sort of):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;SecurityException&lt;/p&gt;

  &lt;p&gt;at MS.Internal.InternalWebRequest.Send()
    &lt;br /&gt;at System.Net.BrowserHttpWebRequest.BeginGetResponseImplementation()

    &lt;br /&gt;at System.Net.BrowserHttpWebRequest.InternalBeginGetResponse(AsyncCallback callback, Object state)

    &lt;br /&gt;at System.Net.AsyncHelper.BeginOnUI(BeginMethod beginMethod, AsyncCallback callback, Object state)

    &lt;br /&gt;at System.Net.BrowserHttpWebRequest.BeginGetResponse(AsyncCallback callback, Object state)

    &lt;br /&gt;at InteraktingMainFeed.Page.GetMainFeed()

    &lt;br /&gt;at InteraktingMainFeed.Page..ctor()

    &lt;br /&gt;at InteraktingMainFeed.App.Application_Startup(Object sender, StartupEventArgs e)

    &lt;br /&gt;at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)

    &lt;br /&gt;at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I was trying everything to fix this until I hit upon the idea of taking Casini (Visual Studio's web server) out of the question (just in case) and setting up a virtual directory on my local IIS to server the &lt;a title="Microsoft Silverlight" href="http://silverlight.net/" rel="" target="_blank"&gt;Silverlight&lt;/a&gt; web app.&lt;/p&gt;

&lt;p&gt;That actually fixes it.  I don't know why this effects the way the &lt;a title="Microsoft Silverlight" href="http://silverlight.net/" rel="" target="_blank"&gt;Silverlight&lt;/a&gt; app works, but it does.  It's highly frustrating and in my opinion completely under-tested.  As developers, we generally need to be able to debug our applications but there is now a nice hurdle in the way and you can't just use F5.  Basically, I'm going to have to attach to the web process to debug.  It's not the end of the world, but it would be nice if I could just debug the lazy way.&lt;/p&gt;

&lt;p&gt;I can see that picking up &lt;a title="Microsoft Silverlight" href="http://silverlight.net/" rel="" target="_blank"&gt;Silverlight&lt;/a&gt; is going to have some nice little challenges along the way.&lt;/p&gt;&lt;img src="http://blogs.interakting.co.uk/mattnield/aggbug/352.aspx" width="1" height="1" /&gt;</description><dc:creator>Matt Nield</dc:creator></item></channel></rss>