<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel xmlns:blog="http://www.dotnetnuke.com/blog/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
    <title>Charles Nurse</title>
    <description>My personal blog on DotNetNuke.</description>
    <link>http://www.dotnetnuke.com/Resources/Blogs/BlogId/15.aspx</link>
    <language>en-US</language>
    <webMaster />
    <pubDate>Thu, 09 Feb 2012 07:47:58 GMT</pubDate>
    <lastBuildDate>Thu, 09 Feb 2012 07:47:58 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 4.0.0.0</generator>
    <item>
      <title>Look Mom &amp;ndash; NoSQL!</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/3224/Look-Mom-ndash-NoSQL.aspx</link>
      <description>&lt;p&gt;Its been a while since I blogged here, but I recently started a new blog series on my personal blog on the topic of NoSQL databases.&lt;/p&gt;  &lt;p&gt;Recently this topic and in particular a particular subclass of databases called  “Document Databases” came up in a discussion the Product Team were having on proposed features for 6.vNext..  &lt;/p&gt;  &lt;p&gt;So I decided it was time to dive into this class of databases in order to find out if they could provide some benefit to us in the Medium to Long Term.&lt;/p&gt;  &lt;p&gt;The topic is very technical so I don’t propose to reproduce every blog post here – but if you are interested in what I find out then feel free to visit my &lt;a href="http://charlesnurse.com/?tag=/NoSQL"&gt;personal blog&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/3224/Look-Mom-ndash-NoSQL.aspx&gt;More ...&lt;/a&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/3224/Look-Mom-ndash-NoSQL.aspx#Comments</comments>
      <slash:comments>1</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/3224/Look-Mom-ndash-NoSQL.aspx</guid>
      <pubDate>Thu, 17 Nov 2011 00:04:31 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=3224</trackback:ping>
    </item>
    <item>
      <title>I&amp;rsquo;ll be speaking at DevReach</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/3176/I-rsquo-ll-be-speaking-at-DevReach.aspx</link>
      <description>I am pleased to announce that I will be speaking at &lt;a href="http://www.devreach.com/"&gt;DevReach&lt;/a&gt; in Sofia, Bulgaria next month.  This is the sixth year for this conference - which bills itself as the Premier Conference on Microsoft Technologies in Eastern and Central Europe - but its the first time for me. &lt;br /&gt;
&lt;h5&gt; &lt;a href="http://www.dotnetnuke.com/Portals/25/Blog/Files/15/3176/Windows-Live-Writer-Ill-be-speaking-at-DevReach_10630-devreach_2.jpg"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px;        border-width: 0px;border-style: solid;" title="devreach" alt="devreach" src="/Portals/25/Blog/Files/15/3176/Windows-Live-Writer-Ill-be-speaking-at-DevReach_10630-devreach_thumb.jpg" width="504" height="83" /&gt;&lt;/a&gt;&lt;/h5&gt;&lt;div class="tags"&gt;Tags: devreach,Conference&lt;/div&gt;&lt;div class="category"&gt;Category: &lt;a href=http://www.dotnetnuke.com/Resources/Blogs/CatID/14.aspx&gt;Events&lt;/a&gt;&lt;/div&gt;</description>
      <author />
      <category domain="http://www.dotnetnuke.com/Resources/Blogs/CatID/14.aspx">Events</category>
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/3176/I-rsquo-ll-be-speaking-at-DevReach.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/3176/I-rsquo-ll-be-speaking-at-DevReach.aspx</guid>
      <pubDate>Sun, 18 Sep 2011 08:00:00 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=3176</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/235.aspx">devreach</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/2.aspx">Conference</blog:tag>
    </item>
    <item>
      <title>Module Categorization in DotNetNuke 6 &amp;ndash; Organize your Modules</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/3127/Module-Categorization-in-DotNetNuke-6-ndash-Organize-your-Modules.aspx</link>
      <description>&lt;p&gt;DotNetNuke 6 introduces some really cool new features – especially the new User Interface – but there are also quite a few smaller enhancements that make it easier for Admins and Host users to manage their site.&lt;/p&gt;  &lt;p&gt;One of these is the concept of Module Categorization.  Module Categorization allows Host users to categorize their modules so that finding a module in the Control Panel is much easier.&lt;/p&gt;  &lt;p&gt;Lets look at how it works.&lt;/p&gt;  &lt;p&gt;When logged in as a Super User browse to the Host &gt;&gt; Extensions module and click on one of the links to edit an Extension.  You will then see a new drop-down list which allows you to choose the category for the module&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetnuke.com/Portals/25/Blog/Files/15/3127/Windows-Live-Writer-f0b16c77606a_9029-image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/Portals/25/Blog/Files/15/3127/Windows-Live-Writer-f0b16c77606a_9029-image_thumb.png" width="640" height="166" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;There are a number of default categories created and most of the modules that are shipped with DotNetNuke are categorized already.  For example the HtmlPro module that is being edited is in the Common Category by default.&lt;/p&gt;  &lt;p&gt;Once a module is categorized, what does this mean?&lt;/p&gt;  &lt;p&gt;When we go to add a module to a page using the new DotNetNuke 6 Control Panel we now see that we can select the category of module that we would like to add.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetnuke.com/Portals/25/Blog/Files/15/3127/Windows-Live-Writer-f0b16c77606a_9029-Module_Categories_2_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Module_Categories_2" border="0" alt="Module_Categories_2" src="/Portals/25/Blog/Files/15/3127/Windows-Live-Writer-f0b16c77606a_9029-Module_Categories_2_thumb.png" width="339" height="414" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In DotNetNuke 5.6 and earlier versions, the Module drop-down list displayed every module available to that user – in some sites the list could be huge, making it difficult to find modules.   In DotNetNuke 6 this drop-down list is filtered based on the selected category, and by default the Common category is preselected.  &lt;/p&gt;  &lt;p&gt;Any module can be added to the Common category, but if managed properly, this should allow Page Administrators to find the module they want to add much easier.&lt;/p&gt;  &lt;p&gt;DotNetNuke 6 Community Edition includes two Categories by default – Admin and Common, but Super Users can add new Module Categories through the Taxonomy module, by adding terms to the Module_Categories Vocabulary.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetnuke.com/Portals/25/Blog/Files/15/3127/Windows-Live-Writer-f0b16c77606a_9029-Module_Categories_3_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Module_Categories_3" border="0" alt="Module_Categories_3" src="/Portals/25/Blog/Files/15/3127/Windows-Live-Writer-f0b16c77606a_9029-Module_Categories_3_thumb.png" width="594" height="254" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;During the Beta process a number of people have suggested adding support for categories to the package manifest to allow the developer to preselect the category on install.   This ability was intentionally left out as the goal of Module Categorization is to allow Super Users to manage the categorization, and allowing extension developers to add categories would defeat this goal.&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/3127/Module-Categorization-in-DotNetNuke-6-ndash-Organize-your-Modules.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: Module,categories,Taxonomy&lt;/div&gt;&lt;div class="category"&gt;Category: &lt;a href=http://www.dotnetnuke.com/Resources/Blogs/CatID/9.aspx&gt;Development&lt;/a&gt;&lt;/div&gt;</description>
      <author />
      <category domain="http://www.dotnetnuke.com/Resources/Blogs/CatID/9.aspx">Development</category>
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/3127/Module-Categorization-in-DotNetNuke-6-ndash-Organize-your-Modules.aspx#Comments</comments>
      <slash:comments>3</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/3127/Module-Categorization-in-DotNetNuke-6-ndash-Organize-your-Modules.aspx</guid>
      <pubDate>Fri, 15 Jul 2011 21:16:37 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=3127</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/5.aspx">Module</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/224.aspx">categories</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/31.aspx">Taxonomy</blog:tag>
    </item>
    <item>
      <title>Its going to be a busy Spring</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2962/Its-going-to-be-a-busy-Spring.aspx</link>
      <description>&lt;p&gt;This year I have decided to place a bigger focus on speaking at Developer Conferences and so over the last few months I have been submitting session proposals to major conferences around North America.&lt;/p&gt;  &lt;p&gt;I am pleased to say that many of my submissions have been accepted and I have quite a busy speaking calendar for the upcoming Spring conference season.&lt;/p&gt;  &lt;h2&gt;VSLive&lt;/h2&gt;  &lt;p&gt;Conference Dates: April 18-22, 2011    &lt;br /&gt;Venue: Rio, Las Vegas     &lt;br /&gt;Website: &lt;a href="http://vslive.com/lv"&gt;http://vslive.com/lv&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://vslive.com/events/spring-2011/home.aspx?utm_source=AttendeeMktg&amp;utm_medium=Miscellaneous&amp;utm_campaign=VLSPK23"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 10px 0px 10px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="VSLLV11_Speak_VLSPK23" border="0" alt="VSLLV11_Speak_VLSPK23" align="right" src="/Portals/25/Blog/Files/15/2962/Windows-Live-Writer-Speaking-Engagements-this-Spring_118F8-VSLLV11_Speak_VLSPK23_3.jpg" width="129" height="129" /&gt;&lt;/a&gt;This excellent conference for .NET Developers is held two or three times a year and in April it will be held in Las Vegas.  I will be presenting two sessions at this conference.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Almighty @ – A Razor Primer &lt;/li&gt;    &lt;li&gt;WebMatrix Real World Data Centric Applications &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you would like to see me speak please use the registration code – VLSPK23 – for a $400 savings.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h2&gt;DevTeach&lt;/h2&gt;  &lt;p&gt;Conference Dates: May 30 – June 3, 2011    &lt;br /&gt;Venue: Intercontinental Hotel, Montreal, Canada     &lt;br /&gt;Website: &lt;a href="http://www.devteach.com/"&gt;http://www.devteach.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This excellent conference which is held annually in one of Canada’s 3 major cities, is this year planned for Montreal in the beautiful province of Quebec.  Come and see me speak on:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Almighty @ – A Razor Primer &lt;/li&gt;    &lt;li&gt;Have your Cake and Eat it Too - Using the WebFormsMVP Framework to Develop Testable Web Applications &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Prairie DevCon&lt;/h2&gt;  &lt;p&gt;Conference Dates: June 13-14, 2011    &lt;br /&gt;Venue: Delta Regina, Regina, Saskatchewan, Canada     &lt;br /&gt;Website: &lt;a href="http://www.prairiedevcon.com/"&gt;http://www.prairiedevcon.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The Prairie Developer Conference is the conference event for software professionals in the Canadian prairies!  At this conference I will be teaming up with my son Andrew to give two Razor presentations&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Nurse&lt;sup&gt;2&lt;/sup&gt; Razor Show – Parts 1 and 2 &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Notice that the focus is Razor – Razor and WebMatrix are new technologies and DotNetNuke’s support for Razor means that I will be able to put a DNN spin on many of my speaking engagements.&lt;/p&gt;  &lt;p&gt;If you plan on attending any of these conferences – ping me (@cnurse is my twiiter alias) – and we can meet up.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;This &lt;a href="http://www.charlesnurse.com/post/Its-going-to-be-a-busy-Spring.aspx"&gt;post&lt;/a&gt; is cross-posted from my &lt;a href="http://www.charlesnurse.com/"&gt;personal blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/2962/Its-going-to-be-a-busy-Spring.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: vslive,devteach,prairiedevcon,razor,webmatrix&lt;/div&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2962/Its-going-to-be-a-busy-Spring.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/2962/Its-going-to-be-a-busy-Spring.aspx</guid>
      <pubDate>Thu, 10 Feb 2011 04:27:49 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=2962</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/172.aspx">vslive</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/173.aspx">devteach</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/174.aspx">prairiedevcon</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/46.aspx">razor</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/45.aspx">webmatrix</blog:tag>
    </item>
    <item>
      <title>Happy New Year 2011</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2932/Happy-New-Year-2011.aspx</link>
      <description>For the fifth year in a row, I awoke this New Years morning to an email from Microsoft, congratulating me on being awarded an MVP (Most Valuable Professional) Award for ASP.NET for the coming year.&lt;div class="tags"&gt;Tags: mvp&lt;/div&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2932/Happy-New-Year-2011.aspx#Comments</comments>
      <slash:comments>5</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/2932/Happy-New-Year-2011.aspx</guid>
      <pubDate>Sat, 01 Jan 2011 08:00:00 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=2932</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/155.aspx">mvp</blog:tag>
    </item>
    <item>
      <title>Razor Tips and Tricks #4 &amp;ndash; Extending the Helpers</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2916/Razor-Tips-and-Tricks-4-ndash-Extending-the-Helpers.aspx</link>
      <description>&lt;p&gt;On Monday, we launched the &lt;a href="http://www.dotnetnuke.com/Community/OtherPrograms/Hackathon/tabid/1566/Default.aspx"&gt;Razor DotNetNuke Hackathon&lt;/a&gt; with a meeting of SEADUG (Seattle DotNetNuke User Group) held at Microsoft offices in beautiful downtown Bellevue.&lt;/p&gt;  &lt;p&gt;For those of you proposing to write Razor “scripts” as part of the Hackathon, I have decided to write a series of short Tips and Tricks.&lt;/p&gt;  &lt;p&gt;In this fourth post I will cover how you can go about extending the provided helpers to provide a simpler API for the scripts to consume.&lt;/p&gt;  &lt;p&gt;The DotNetNukeWebPage class, which is the base class for all Razor scripts used in DotNetNuke has three additional properties.&lt;/p&gt; &lt;style type="text/css"&gt;

        .csharpcode, .csharpcode pre
        {
        font-size: medium
        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; }
    &lt;/style&gt;  &lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="600"&gt;         &lt;h3&gt;&lt;em&gt;Figure 1 – DotNetNukeWebPage Proeprties&lt;/em&gt;&lt;/h3&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="600"&gt;         &lt;div class="csharpcode"&gt;           &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;Protected&lt;/span&gt; &lt;span class="kwrd"&gt;Friend&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt; Dnn &lt;span class="kwrd"&gt;As&lt;/span&gt; DnnHelper&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;Protected&lt;/span&gt; &lt;span class="kwrd"&gt;Friend&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt; Html &lt;span class="kwrd"&gt;As&lt;/span&gt; HtmlHelper&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;Protected&lt;/span&gt; &lt;span class="kwrd"&gt;Friend&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt; Url &lt;span class="kwrd"&gt;As&lt;/span&gt; UrlHelper&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;In this tip we are going to extend the Dnn property to add an extra method.  The Dnn property is an instance of the DnnHelper class which is defined in the DotNetNuke.Web.Razor library.&lt;/p&gt;

&lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;
        &lt;h3&gt;&lt;em&gt;Figure 2 - The DnnHelper Class&lt;/em&gt;&lt;/h3&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;
        &lt;div class="csharpcode"&gt;
          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;Class&lt;/span&gt; DnnHelper&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;Private&lt;/span&gt; _context &lt;span class="kwrd"&gt;As&lt;/span&gt; ModuleInstanceContext&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt; &lt;span class="kwrd"&gt;New&lt;/span&gt;(&lt;span class="kwrd"&gt;ByVal&lt;/span&gt; context &lt;span class="kwrd"&gt;As&lt;/span&gt; ModuleInstanceContext)&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        _context = context&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Sub&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;ReadOnly&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt; [&lt;span class="kwrd"&gt;Module&lt;/span&gt;] &lt;span class="kwrd"&gt;As&lt;/span&gt; ModuleInfo&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;            &lt;span class="kwrd"&gt;Return&lt;/span&gt; _context.Configuration&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;ReadOnly&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt; Tab &lt;span class="kwrd"&gt;As&lt;/span&gt; TabInfo&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;        &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            &lt;span class="kwrd"&gt;Return&lt;/span&gt; _context.PortalSettings.ActiveTab&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    &lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;ReadOnly&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt; Portal &lt;span class="kwrd"&gt;As&lt;/span&gt; PortalSettings&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            &lt;span class="kwrd"&gt;Return&lt;/span&gt; _context.PortalSettings&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    &lt;span class="kwrd"&gt;Public&lt;/span&gt; &lt;span class="kwrd"&gt;ReadOnly&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt; User &lt;span class="kwrd"&gt;As&lt;/span&gt; UserInfo&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;            &lt;span class="kwrd"&gt;Return&lt;/span&gt; _context.PortalSettings.UserInfo&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Get&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    &lt;span class="kwrd"&gt;End&lt;/span&gt; &lt;span class="kwrd"&gt;Property&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;&lt;span class="kwrd"&gt;End&lt;/span&gt; Class&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;Imagine that you want to write a script which lists all of the roles on the site. You could use the full DotNetNuke API in your Razor script as shown in Figure 3&lt;/p&gt;

&lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;
        &lt;h3&gt;&lt;em&gt;Figure 3 – Role List script&lt;/em&gt;&lt;/h3&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="RazorTips_01" border="0" alt="RazorTips_01" src="/Portals/25/Blog/Files/15/2916/Windows-Live-Writer-Razor-Tips-and-Tricks-4--Help_F5C1-RazorTips_01_3.png" width="544" height="282" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;There is nothing wrong with this – it works.  But what if you could have a much simpler script to do the same task (Figure 4).&lt;/p&gt;

&lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;
        &lt;h3&gt;&lt;em&gt;Figure 4 – Simplified Role List script&lt;/em&gt;&lt;/h3&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="RazorTips_02" border="0" alt="RazorTips_02" src="/Portals/25/Blog/Files/15/2916/Windows-Live-Writer-Razor-Tips-and-Tricks-4--Help_F5C1-RazorTips_02_3.png" width="373" height="186" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;For beginner developers who are trying their hand at DotNetNuke development using the Razor Host module, this is much more intuitive.  But GetRoles() is not a member of the DnnHelper class, and I don’t want to modify a core class.  This is where the wonders of Extension methods comes in.  Since C# 3 (or VB 9) which shipped with Visual Studio 2008, we have been able to add functionality to existing classes, without modifying the class directly.&lt;/p&gt;

&lt;p&gt;In a separate project, I added a class DnnHelperExtensions, where I defined the following extension method (Figure 5).&lt;/p&gt;

&lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="588"&gt;
        &lt;h3&gt;&lt;em&gt;Figure 5 – GetRoles Extension Method&lt;/em&gt;&lt;/h3&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="589"&gt;
        &lt;div class="csharpcode"&gt;
          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&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; DnnHelperExtensions&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; List&lt;String&gt; GetRoles(&lt;span class="kwrd"&gt;this&lt;/span&gt; DnnHelper helper)&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    {&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        var controller = &lt;span class="kwrd"&gt;new&lt;/span&gt; RoleController();&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        var _roles = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&lt;String&gt;(controller.GetRoleNames(&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;                                    helper.Portal.PortalId&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;                                    ));&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt; &lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; _roles;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    }&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;}&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;This method hides the DotNetNuke complexity from the scripter.   We don’t need to worry about what namespace(s) to include in our script and we don’t care that GetRoleNames needs a PortalId as the helper method takes care of it.&lt;/p&gt;

&lt;p&gt;There is one final step that we need to do to get this to work.  We need to add a reference to the Helpers namespace in the web.config file that lives in the RazorModules folder.&lt;/p&gt;

&lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="588"&gt;
        &lt;h3&gt;&lt;em&gt;Figure 6 – Updating web.config&lt;/em&gt;&lt;/h3&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="589"&gt;
        &lt;div class="csharpcode"&gt;
          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;system.web.webPages.razor&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;pages&lt;/span&gt; &lt;span class="attr"&gt;pageBaseType&lt;/span&gt;&lt;span class="kwrd"&gt;="DotNetNuke.Web.Razor.DotNetNukeWebPage"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;namespaces&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;namespace&lt;/span&gt;&lt;span class="kwrd"&gt;="Microsoft.Web.Helpers"&lt;/span&gt; &lt;span class="kwrd"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;namespace&lt;/span&gt;&lt;span class="kwrd"&gt;="WebMatrix.Data"&lt;/span&gt; &lt;span class="kwrd"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;namespace&lt;/span&gt;&lt;span class="kwrd"&gt;="DotNetNuke.Web.Razor.Helpers"&lt;/span&gt; &lt;span class="kwrd"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&lt;/&lt;/span&gt;&lt;span class="html"&gt;namespaces&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&lt;/&lt;/span&gt;&lt;span class="html"&gt;pages&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;&lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web.webPages.razor&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;In the final release of the Razor Host Module, we will add the DotNetNuke.Web.Razor.Helpers namespace to the web.config included, and we will start to flesh out the DnnHelper class with some more intuitive methods.  &lt;/p&gt;

&lt;p&gt;However, if ever ever feel that something is missing you can create your own.  Just make sure that all your helper Extension Methods are in the same namespace and all you will need to do is add the assembly to the bin folder, and they will just work.&lt;/p&gt;

&lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;
        &lt;h3&gt;&lt;em&gt;Figure 7 – The Resulting Razor Script in Action.&lt;/em&gt;&lt;/h3&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="600"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="RazorTips_03" border="0" alt="RazorTips_03" src="/Portals/25/Blog/Files/15/2916/Windows-Live-Writer-Razor-Tips-and-Tricks-4--Help_F5C1-RazorTips_03_3.png" width="233" height="135" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;em&gt;This &lt;a href="http://www.charlesnurse.com/post/Razor-Tips-and-Tricks-4-Extending-the-Helpers.aspx"&gt;post&lt;/a&gt; is cross-posted from my &lt;a href="http://www.charlesnurse.com/"&gt;personal blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/2916/Razor-Tips-and-Tricks-4-ndash-Extending-the-Helpers.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: razor,webmatrix,Hackathon&lt;/div&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2916/Razor-Tips-and-Tricks-4-ndash-Extending-the-Helpers.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/2916/Razor-Tips-and-Tricks-4-ndash-Extending-the-Helpers.aspx</guid>
      <pubDate>Thu, 09 Dec 2010 03:52:13 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=2916</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/46.aspx">razor</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/45.aspx">webmatrix</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/15.aspx">Hackathon</blog:tag>
    </item>
    <item>
      <title>Razor Tips and Tricks #3 &amp;ndash; &amp;ldquo;Look, No forms&amp;rdquo;</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2915/Razor-Tips-and-Tricks-3-ndash-ldquo-Look-No-forms-rdquo.aspx</link>
      <description>&lt;p&gt;On Monday, we launched the &lt;a href="http://www.dotnetnuke.com/Community/OtherPrograms/Hackathon/tabid/1566/Default.aspx"&gt;Razor DotNetNuke Hackathon&lt;/a&gt; with a meeting of SEADUG (Seattle DotNetNuke User Group) held at Microsoft offices in beautiful downtown Bellevue.&lt;/p&gt; &lt;p&gt;For those of you proposing to write Razor “scripts” as part of the Hackathon, I have decided to write a series of short Tips and Tricks.&lt;/p&gt; &lt;p&gt;In this third post I will cover a couple of caveats when using Razor scripts in the DotNetNuke context.&lt;/p&gt; &lt;h2&gt;No Forms&lt;/h2&gt; &lt;p&gt;The first caveat is that because the Razor script is still running within the context of a ASP.NET WebForm, you need to be careful when using Razor scripts that you find (or write yourself) for collecting form data.  &lt;form&gt; tags cannot be embedded inside other form tags – and because an ASP.NET WebForm (.aspx) always contain a &lt;form&gt; tag, this means that Razor scripts used in the DotNetNuke context cannot contain &lt;form&gt; tags.&lt;/p&gt; &lt;p&gt;The workaround is simple – just remove the &lt;form&gt; tags from any Razor script you use in DotNetNuke.  Any submit button will post back as usual and DotNetNuke will pass the Form variables to the script as normal.&lt;/p&gt; &lt;h2&gt;Urls&lt;/h2&gt; &lt;p&gt;The second caveat is that you should be careful with following Razor script examples that use Urls.  For example you will often see something like:&lt;/p&gt;&lt;pre class="csharpcode"&gt;@RenderPage(&lt;span class="str"&gt;"/Shared/_Header.cshtml"&lt;/span&gt;);&lt;br&gt;&lt;/pre&gt;
&lt;style type="text/css"&gt;
.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; }&lt;/style&gt;

&lt;p&gt;&lt;br&gt;The initial “/” means that we the url is starting at the web-root.  As most Razor examples you see will assume that your Razor script is executing in the context of web-root – this example is fine.  But in DotNetNuke, the Shared directory would probably be buried deep in the website folder structure (for example ~/DesktopModules/RazorModules/MyModule/Shared/).  &lt;/p&gt;
&lt;p&gt;In this case just leave out the initial “/” so that the url is relative.&lt;/p&gt;&lt;pre class="csharpcode"&gt;@RenderPage(&lt;span class="str"&gt;"Shared/_Header.cshtml"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="csharpcode"&gt; &lt;/pre&gt;
&lt;p&gt;&lt;em&gt;This &lt;a href="http://www.charlesnurse.com/post/Razor-Tips-and-Tricks-3-Look-No-forms.aspx"&gt;post&lt;/a&gt; is cross-posted from my &lt;a href="http://www.charlesnurse.com/"&gt;personal blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/2915/Razor-Tips-and-Tricks-3-ndash-ldquo-Look-No-forms-rdquo.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: razor,webmatrix&lt;/div&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2915/Razor-Tips-and-Tricks-3-ndash-ldquo-Look-No-forms-rdquo.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/2915/Razor-Tips-and-Tricks-3-ndash-ldquo-Look-No-forms-rdquo.aspx</guid>
      <pubDate>Wed, 08 Dec 2010 15:21:38 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=2915</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/46.aspx">razor</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/45.aspx">webmatrix</blog:tag>
    </item>
    <item>
      <title>Razor Tips and Tricks #2 &amp;ndash; Razor&amp;rsquo;s Custom web.config File</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2914/Razor-Tips-and-Tricks-2-ndash-Razor-rsquo-s-Custom-web-config-File.aspx</link>
      <description>&lt;p&gt;Yesterday we launched the &lt;a href="http://www.dotnetnuke.com/Community/OtherPrograms/Hackathon/tabid/1566/Default.aspx"&gt;Razor DotNetNuke Hackathon&lt;/a&gt; with a meeting of SEADUG (Seattle DotNetNuke User Group) held at Microsoft offices in beautiful downtown Bellevue. &lt;/p&gt;  &lt;p&gt;For those of you proposing to write Razor “scripts” as part of the Hackathon, I have decided to write a series of short Tips and Tricks.&lt;/p&gt;  &lt;p&gt;In this second post I will provide some information about the web.config file located in the RazorModules folder.&lt;/p&gt;  &lt;p&gt;One of the neat features of Razor/WebPages is that the parser is highly configurable.  Its configuration is controlled by a new section in web.config (shown in Figure 1).  In theory the section can be placed in the web.config file in the web root, but as it is only of interest to Razor it can be placed in a custom web.config file in DesktopModules. &lt;/p&gt;  &lt;p&gt;The file distributed with the Razor Host module is installed into the ~/DesktopModules/RazorModules folder.&lt;/p&gt; &lt;style type="text/css"&gt;

    .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; }&lt;/style&gt;  &lt;table border="0" cellspacing="5" cellpadding="5" width="600"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="600"&gt;         &lt;h3&gt;&lt;em&gt;Figure 1 –  Custom web.config file&lt;/em&gt;&lt;/h3&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="600"&gt;         &lt;div class="csharpcode"&gt;           &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;system.web.webPages.razor&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;pages&lt;/span&gt; &lt;span class="attr"&gt;pageBaseType&lt;/span&gt;&lt;span class="kwrd"&gt;="DotNetNuke.Web.Razor.DotNetNukeWebPage"&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;namespaces&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;namespace&lt;/span&gt;&lt;span class="kwrd"&gt;="Microsoft.Web.Helpers"&lt;/span&gt; &lt;span class="kwrd"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;namespace&lt;/span&gt;&lt;span class="kwrd"&gt;="WebMatrix.Data"&lt;/span&gt; &lt;span class="kwrd"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&lt;/&lt;/span&gt;&lt;span class="html"&gt;namespaces&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&lt;/&lt;/span&gt;&lt;span class="html"&gt;pages&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;

          &lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web.webPages.razor&lt;/span&gt;&lt;span class="kwrd"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;The entry on line 2 of the file tells the Razor parser that the Razor base type is DotNetNukeWebPage (not WebPage), and the namespaces nodes tell the parser to automatically “include” the specified namespaces.&lt;/p&gt;

&lt;p&gt;If you want/need to use other namespaces – maybe from helpers that you wrote yourself – or that you found on the Internet - then adding the namespaces here means that you do not need “@using” statements in the .cshtml file(s).&lt;/p&gt;

&lt;p&gt;By convention, the RazorHost module is installed in the RazorModules folder and as long as any other Razor module is located in a subfolder of RazorModules then it will “inherit” the settings in this custom web.config.  &lt;/p&gt;

&lt;p&gt;So, if you want to place your Razor script somewhere else – say DesktopModules/MyModules then you will need to deploy your own version of the web.config which contains the &lt;pages&gt; node at the least.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This &lt;a href="http://www.charlesnurse.com/post/Razor-Tips-and-Tricks-2-Razors-Custom-webconfig-File.aspx"&gt;post&lt;/a&gt; is cross-posted from my &lt;a href="http://www.charlesnurse.com/"&gt;personal blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/2914/Razor-Tips-and-Tricks-2-ndash-Razor-rsquo-s-Custom-web-config-File.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: razor,webmatrix,Hackathon&lt;/div&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2914/Razor-Tips-and-Tricks-2-ndash-Razor-rsquo-s-Custom-web-config-File.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/2914/Razor-Tips-and-Tricks-2-ndash-Razor-rsquo-s-Custom-web-config-File.aspx</guid>
      <pubDate>Wed, 08 Dec 2010 01:33:40 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=2914</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/46.aspx">razor</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/45.aspx">webmatrix</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/15.aspx">Hackathon</blog:tag>
    </item>
    <item>
      <title>Razor Tips and Tricks &amp;ndash;#1&amp;ndash;Required Assemblies</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2912/Razor-Tips-and-Tricks-ndash-1-ndash-Required-Assemblies.aspx</link>
      <description>&lt;p&gt;Yesterday we launched the &lt;a href="http://www.dotnetnuke.com/Community/OtherPrograms/Hackathon/tabid/1566/Default.aspx"&gt;Razor DotNetNuke Hackathon&lt;/a&gt; with a meeting of SEADUG (Seattle DotNetNuke User Group) held at the Microsoft offices in beautiful downtown Bellevue.  &lt;/p&gt;  &lt;p&gt;For those of you proposing to write Razor “scripts” as part of the Hackathon I have decided to start a series of short Tips and Tricks.&lt;/p&gt;  &lt;p&gt;In this first post I will provide the first Tip for anyone wanting to bundle their Razor Module for distribution to users who do not have WebMatrix OR the Razor Host Module installed on their machines.&lt;/p&gt;  &lt;p&gt;When you try and create a Package from your Razor script using the Create Package Wizard, you are prompted for a list of assemblies to include.  Here is the complete List&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;DotNetNuke.Web.Razor.dll &lt;/li&gt;    &lt;li&gt;Microsoft.Web.Helpers.dll &lt;/li&gt;    &lt;li&gt;System.Web.Helpers.dll &lt;/li&gt;    &lt;li&gt;System.Web.Razor.dll &lt;/li&gt;    &lt;li&gt;System.Web.WebPages.dll &lt;/li&gt;    &lt;li&gt;System.Web.WebPages.Razor.dll &lt;/li&gt;    &lt;li&gt;WebMatrix.Data.dll &lt;/li&gt;    &lt;li&gt;WebMatrix.WebData.dll &lt;/li&gt;    &lt;li&gt;Microsoft.Web.Infrastructure.dll &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Of course, you can leave these out of you own package if you intend your users to have already installed the Razor Host module.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;This &lt;a href="http://www.charlesnurse.com/post/Razor-Tips-and-Tricks-1-Required-Assemblies.aspx"&gt;post&lt;/a&gt; is cross-posted from my &lt;a href="http://www.charlesnurse.com"&gt;personal blog&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/2912/Razor-Tips-and-Tricks-ndash-1-ndash-Required-Assemblies.aspx&gt;More ...&lt;/a&gt;&lt;div class="tags"&gt;Tags: razor,webmatrix,Hackathon&lt;/div&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2912/Razor-Tips-and-Tricks-ndash-1-ndash-Required-Assemblies.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/2912/Razor-Tips-and-Tricks-ndash-1-ndash-Required-Assemblies.aspx</guid>
      <pubDate>Tue, 07 Dec 2010 15:25:02 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=2912</trackback:ping>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/46.aspx">razor</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/45.aspx">webmatrix</blog:tag>
      <blog:tag blog:url="http://www.dotnetnuke.com/Resources/Blogs/TagID/15.aspx">Hackathon</blog:tag>
    </item>
    <item>
      <title>WebMatrix and DNN &amp;ndash; 7 &amp;ndash; Razor Scripting Deep Dive</title>
      <link>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2886/WebMatrix-and-DNN-ndash-7-ndash-Razor-Scripting-Deep-Dive.aspx</link>
      <description>&lt;p&gt;In earlier articles in this series on the new WebMatrix suite of technologies from Microsoft, I described how we are supporting the use of Razor scripts in DotNetNuke, by providing a “Razor Host” module.&lt;/p&gt;  &lt;p&gt;But what is Razor?  &lt;/p&gt;  &lt;p&gt;On my personal &lt;a href="http://www.charlesnurse.com"&gt;blog&lt;/a&gt; I have recently started a new series of articles that take a deep dive into the Razor Syntax.  As these articles deal exclusively with Razor and WebPages, I decided not to cross-post them here.&lt;/p&gt;  &lt;p&gt;However, for those interested in learning more about Razor then you can find the first three articles here.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.charlesnurse.com/post/Razor-and-WebPages-1-A-New-Way-to-Create-Web-Applications.aspx"&gt;Razor and WebPages – 1 – A New Way to Create Web Applications&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.charlesnurse.com/post/Razor-and-WebPages-2-The-Almighty-at.aspx"&gt;Razor and WebPages – 2 – The Almighty @&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.charlesnurse.com/post/WebPages-and-Razor-3-Razor-syntax.aspx"&gt;Razor and WebPages – 3 – Razor syntax&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The series is not complete – the following topics are planned.&lt;/p&gt;  &lt;p&gt;Razor and WebPages – 4 – Razor Forms&lt;/p&gt;  &lt;p&gt;Razor and WebPages – 5 – Using Data in WebPages&lt;/p&gt;  &lt;p&gt;Razor and WebPages – 6 – Using Helpers&lt;/p&gt;  &lt;p&gt;Razor and WebPages – 7 – Writing your own Helpers&lt;/p&gt;&lt;br /&gt;&lt;a href=http://www.dotnetnuke.com/Resources/Blogs/EntryId/2886/WebMatrix-and-DNN-ndash-7-ndash-Razor-Scripting-Deep-Dive.aspx&gt;More ...&lt;/a&gt;</description>
      <author />
      <comments>http://www.dotnetnuke.com/Resources/Blogs/EntryId/2886/WebMatrix-and-DNN-ndash-7-ndash-Razor-Scripting-Deep-Dive.aspx#Comments</comments>
      <slash:comments>0</slash:comments>
      <guid isPermaLink="true">http://www.dotnetnuke.com/Resources/Blogs/EntryId/2886/WebMatrix-and-DNN-ndash-7-ndash-Razor-Scripting-Deep-Dive.aspx</guid>
      <pubDate>Thu, 25 Nov 2010 15:33:41 GMT</pubDate>
      <trackback:ping>http://www.dotnetnuke.comDesktopModules/BlogTrackback.aspx?id=2886</trackback:ping>
    </item>
  </channel>
</rss>
