<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Captain Codeman&#187; Rendering</title>
	<atom:link href="http://www.captaincodeman.com/category/mvc/mvc-rendering/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.captaincodeman.com</link>
	<description>Software Developer</description>
	<lastBuildDate>Fri, 15 Jul 2011 22:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Absolute URLs using MVC (without extension methods)</title>
		<link>http://www.captaincodeman.com/2010/02/03/absolute-urls-using-mvc-without-extension-methods/</link>
		<comments>http://www.captaincodeman.com/2010/02/03/absolute-urls-using-mvc-without-extension-methods/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 17:29:49 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[Routing]]></category>
		<category><![CDATA[action]]></category>

		<guid isPermaLink="false">http://blogs.intesoft.net/post.aspx?id=019a9ef7-023a-46c7-97a9-94fd14f7a28e</guid>
		<description><![CDATA[Do you need to generate absolute URLs within your MVC application? Often this will be in the form of URLs used outside of the web-browser such as those used within Atom Publishing Protocol collections or maybe links that are going to be sent out in emails. Basically, anything where the regular relative URL won’t do.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Do you need to generate absolute URLs within your MVC application?</p>
<p>Often this will be in the form of URLs used outside of the web-browser such as those used within Atom Publishing Protocol collections or maybe links that are going to be sent out in emails. Basically, anything where the regular relative URL won’t do.</p>
<p>A quick search of Google will turn up a number of blog posts or forum answers showing how to do this by creating extension methods for the Url helper class but really, everything that is needed is already baked into the MVC framework already … and I’ve only just realized it after using it since the CTP releases!</p>
<p><span id="more-4"></span></p>
<p>All you need to do is specify the protocol within the Url.Action or Url.RouteUrl method. Here are some regular looking URLs:</p>
<pre class="csharpcode">&lt;%= Url.Action(<span class="str">"About"</span>, <span class="str">"Home"</span>) %&gt;&lt;br /&gt;
&lt;%= Url.RouteUrl(<span class="str">"Default"</span>, <span class="kwrd">new</span> { Action = <span class="str">"About"</span> }) %&gt;&lt;br /&gt;</pre>
<p><!-- .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; } --></p>
<p>Which produce the same output:</p>
<p>/Home/About</p>
<p>/Home/About</p>
<p>If we add the protocol then it changes to:</p>
<pre class="csharpcode">&lt;%= Url.Action(<span class="str">"About"</span>, <span class="str">"Home"</span>, <span class="kwrd">null</span>, <span class="str">"http"</span>) %&gt;&lt;br /&gt;
&lt;%= Url.RouteUrl(<span class="str">"Default"</span>, <span class="kwrd">new</span> { Action = <span class="str">"About"</span> }, <span class="str">"http"</span>) %&gt;&lt;br /&gt;</pre>
<p><!-- .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; } --></p>
<p>http://localhost:51868/Home/About</p>
<p>http://localhost:51868/Home/About</p>
<p>Instead of having the ‘http’ hard-coded like that you can instead use whatever protocol was used for the request so URLs will be correct whether they are using http or https (assuming they don’t need to be a specific one), e.g.:</p>
<pre class="csharpcode">&lt;%= Url.Action(<span class="str">"About"</span>, <span class="str">"Home"</span>, <span class="kwrd">null</span>, Request.Url.Scheme) %&gt;&lt;br /&gt;
&lt;%= Url.RouteUrl(<span class="str">"Default"</span>, <span class="kwrd">new</span> { Action = <span class="str">"About"</span> }, Request.Url.Scheme) %&gt;&lt;br /&gt;</pre>
<p><!-- .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; } --></p>
<p>If you just pass the protocol / scheme then the host name and port number are generated automatically based on the site that the app is running on. You can also pass the host name as well if you want (if the public host name doesn’t match the one the site is actually running on).</p>
<p>This works for the Url helper only, the protocol isn’t an option in the Html helper used to general complete html anchor links but I’m guessing that if you need an absolute URL you are needing something else beyond a plain link anyway and it isn’t too much trouble to just define the anchor element in a view and use the Url helper in the href attribute only.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.captaincodeman.com/2010/02/03/absolute-urls-using-mvc-without-extension-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When to use RenderAction vs RenderPartial with ASP.NET MVC</title>
		<link>http://www.captaincodeman.com/2009/02/21/when-to-use-renderaction-vs-renderpartial-with-asp-net-mvc/</link>
		<comments>http://www.captaincodeman.com/2009/02/21/when-to-use-renderaction-vs-renderpartial-with-asp-net-mvc/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 23:36:55 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://blogs.intesoft.net/post.aspx?id=ba353b21-0cfd-4960-8c1f-510d9f4907ee</guid>
		<description><![CDATA[At first glance, RenderAction and RenderPartial both do a very similar thing – they load ‘some other content’ into the view being rendered at the place they are called. Personally, I think they should be used for different scenarios so these are my thoughts on where each one should be used and why. First though,


No related posts.]]></description>
			<content:encoded><![CDATA[<p>At first glance, RenderAction and RenderPartial both do a very similar thing – they load ‘some other content’ into the view being rendered at the place they are called. Personally, I think they should be used for different scenarios so these are my thoughts on where each one should be used and why.</p>
<p>First though, a quick recap on what they do:</p>
<ul>
<li>RenderPartial renders a control with some model passed to it. </li>
<li>RenderAction (or <a title="RenderSubAction alternative to RenderAction for Sub-Controllers in MVC" href="http://blogs.intesoft.net/post/2009/02/RenderSubAction-alternative-to-RenderAction-for-sub-controllers-using-asp-net-mvc.aspx" target="_blank">RenderSubAction</a> which addresses some issues) calls a controller action and then renders whatever view that returns with whatever model that controller action passes through it. </li>
</ul>
<p>Hmmn, they sound pretty similar don’t they! The thing to note though is that the model passed to RenderPartial is <em><strong>either</strong></em> the current model being rendered by the calling view <em>or a subset of it</em>. Anything that a RenderPartial view being called is going to need has to be passed into the Model of the calling view. The view rendered using RenderAction on the other hand could contain a completely different model with no need for this to be passed in to our parent view.</p>
<p>Because of this, I think RenderPartial is most appropriate when what it is going to output could be considered part of the calling view but separating it out into a user control makes sense to allow re-use and avoid repeating the same rendering code in multiple views. For example, if you are rendering a person name in lots of places then instead of repeating within each view the code to output it:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span><span class="kwrd">=&quot;&lt;%= Url.Action(&quot;</span><span class="attr">Display</span><span class="kwrd">&quot;, &quot;</span><span class="attr">Person</span><span class="kwrd">&quot;, new { id = Model.Person.Id}) %&gt;&quot;</span><span class="kwrd">&gt;</span>
  <span class="asp">&lt;%</span>= Model.Person.Salutation <span class="asp">%&gt;</span> <span class="asp">&lt;%</span>= Model.Person.Forename <span class="asp">%&gt;</span> <span class="asp">&lt;%</span>= Model.Person.Surname <span class="asp">%&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span></pre>
<p>
  <br />Instead, you move this to a separate user control such as ‘PersonName.ascx’ which expects a Person as the model:</p>
<pre class="csharpcode"><span class="asp">&lt;%@ Control Language=&quot;C#&quot; Inherits=&quot;System.Web.Mvc.ViewUserControl&lt;Person&gt;&quot; %&gt;</span>
<span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span><span class="kwrd">=&quot;&lt;%= Url.Action(&quot;</span><span class="attr">Display</span><span class="kwrd">&quot;, &quot;</span><span class="attr">Person</span><span class="kwrd">&quot;, new { id = Model.Id}) %&gt;&quot;</span><span class="kwrd">&gt;</span>
    <span class="asp">&lt;%</span>= Model.Salutation <span class="asp">%&gt;</span> <span class="asp">&lt;%</span>= Model.Forename <span class="asp">%&gt;</span> <span class="asp">&lt;%</span>= Model.Surname <span class="asp">%&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span></pre>
<p>
  <br />Now, any place a view wants to output a persons name then you can instead call a PartialView and pass in the appropriate model:</p>
<pre class="csharpcode"><span class="asp">&lt;%</span>= Html.RenderPartial(<span class="str">&quot;PersonName&quot;</span>, Model.Person); <span class="asp">%&gt;</span>&#160;</pre>
<p>
  <br />Why would you want to do this? Well, it helps consistency and avoids repetition which makes it easy if, for example, you decide that name should not longer be in the format “Mr John Smith” but instead “Smith, John (Mr)” and you want to throw in a little jQuery magic to display a profile popup whenever anyone hovers the mouse over the name. This is a simple example but hopefully it demonstrates some benefits of using it compared to repeating the code in each view – with larger chunks of output the benefits of using RenderPartial would be even more apparent</p>
<p>So that is where and how I think RenderPartial should be used. How about RenderAction?</p>
<p>Well, I think this has it’s place when the thing that needs to be rendered <em><strong>isn’t the responsibility of the calling view or controller</strong></em>.</p>
<p>For example, I may have a PersonController responsible for CRUD operations on the Person class including a Display action and view but I do not want either of these to have any responsibility for anything to do with the display of Projects that the person is working on. If I want to display a list of assigned projects within the Person Display view then I would use RenderAction to add it but the responsibility and knowledge of how to do this resides with the ProjectController and it’s views. This would be called as follows:</p>
<pre class="csharpcode"><span class="asp">&lt;%</span> Html.RenderAction(<span class="str">&quot;List&quot;</span>, <span class="str">&quot;Project&quot;</span>, <span class="kwrd">new</span> {personId = Model.Person.Id}); <span class="asp">%&gt;</span>&#160;</pre>
<p>
  <br />(incidentally … note that, unlike many of the other extension methods, RenderAction doesn’t return a string so there is no ‘=’ at the beginning and a ‘;’ at the end)</p>
<p>Now, how the Project List is retrieved and rendered is completely the concern of the ProjectController class as it should be and the output can contain whatever it needs to display the list, provide actions to edit project entries and so on.</p>
<p>Another benefit of this approach is if you create different skinned versions of an app. By keeping things modular it is much easier to decide to include something in the view for one skin but not another. So, the skin (set of views) for a full desktop browser may call RenderAction to include the list in the same page whereas the skin for a mobile device friendly interface (think iPhone) would perhaps just include a link instead – both are handled by changing the view instead of changing the controllers which could otherwise be the case.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.captaincodeman.com/2009/02/21/when-to-use-renderaction-vs-renderpartial-with-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RenderSubAction alternative to RenderAction for Sub-Controllers in MVC</title>
		<link>http://www.captaincodeman.com/2009/02/21/rendersubaction-alternative-to-renderaction-for-sub-controllers-in-mvc/</link>
		<comments>http://www.captaincodeman.com/2009/02/21/rendersubaction-alternative-to-renderaction-for-sub-controllers-in-mvc/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 22:08:12 +0000</pubDate>
		<dc:creator>Captain Codeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Rendering]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[render]]></category>

		<guid isPermaLink="false">http://blogs.intesoft.net/post.aspx?id=2588ca1e-5544-4616-bc54-b4d75e6f8e99</guid>
		<description><![CDATA[The ASP.NET MVC Futures assembly contains several RenderAction extension methods for HtmlHelper to allow another action to be rendered at some point within a view. Typically, this allows each controller to handle different responsibilities rather than things being combined into the parent. So, for example, a PersonController is responsible for retrieving and assembling the model


No related posts.]]></description>
			<content:encoded><![CDATA[<p>The ASP.NET MVC Futures assembly contains several RenderAction extension methods for HtmlHelper to allow another action to be rendered at some point within a view. Typically, this allows each controller to handle different responsibilities rather than things being combined into the parent.</p>
<p>So, for example, a PersonController is responsible for retrieving and assembling the model to represent a Person and pass it to the View for rendering but it should not handle Contacts – the display and CRUD operations on contacts should be handled by a ContactController and RenderAction is a convenient way to insert a list of contacts for a person into the persion display view.</p>
<p>So, we have a PersonController which will retrieve a Person model and pass it to the Display view. Inside this Display view, we have a call to render a list of contacts for that person:</p>
<p><font face="Courier New">&lt;% Html.RenderSubAction(&quot;List&quot;, &quot;Contact&quot;, new { personId = Model.Id }); %&gt;</font></p>
<p>I’ve come across two problems when using this though:</p>
<p>1. If the parent controller action requested uses the HTTP POST method then the controller action picked up for all child actions will <em>also</em> be the POST version (if there is one). This is rarely the desired behavior though – I’d only expect to be sending a POST to the ContactController when I want to change something related to a contact and not when updating a person.</p>
<p>2. If the [ValidateInput(false)] attribute is used to allow HTML code to be posted (imagine a ‘Biography’ field on Person with a nice WYSIWYG TinyMCE Editor control …) then the request will fail unless all the child actions are automatically marked with the same attribute. I would prefer to only have to mark the methods I specifically want a POST request containing HTML input to be called.</p>
<p>So, I created a set of alternative RenderSubAction extension methods which address both these issues:</p>
<p>1. Whatever the HTTP method used for the parent action, the routing will match the GET version for child actions called.</p>
<p>2. The state of the [ValidateInput()] attribute will be set on all child actions called.</p>
<p>The code is below … just reference the namespace that you put it in within your web.config file and then change the RenderAction method to RenderSubAction – the method signatures are identical so it is a drop-in replacement.</p>
<p>I’d be interested in any feedback on this approach.</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">class</span> HtmlHelperExtensions {
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RenderSubAction&lt;TController&gt;(<span class="kwrd">this</span> HtmlHelper helper,             Expression&lt;Action&lt;TController&gt;&gt; action)
        <span class="kwrd">where</span> TController : Controller {
        RouteValueDictionary routeValuesFromExpression = ExpressionHelper</pre>
<pre class="csharpcode">            .GetRouteValuesFromExpression(action);
        helper.RenderRoute(routeValuesFromExpression);
    }

    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RenderSubAction(<span class="kwrd">this</span> HtmlHelper helper, <span class="kwrd">string</span> actionName) {
        helper.RenderSubAction(actionName, <span class="kwrd">null</span>);
    }

    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RenderSubAction(<span class="kwrd">this</span> HtmlHelper helper, <span class="kwrd">string</span> actionName, <span class="kwrd">string</span> controllerName) {
        helper.RenderSubAction(actionName, controllerName, <span class="kwrd">null</span>);
    }

    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RenderSubAction(<span class="kwrd">this</span> HtmlHelper helper, <span class="kwrd">string</span> actionName, <span class="kwrd">string</span> controllerName,             <span class="kwrd">object</span> routeValues) {
        helper.RenderSubAction(actionName, controllerName, <span class="kwrd">new</span> RouteValueDictionary(routeValues));
    }

    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RenderSubAction(<span class="kwrd">this</span> HtmlHelper helper, <span class="kwrd">string</span> actionName, <span class="kwrd">string</span> controllerName,
                                    RouteValueDictionary routeValues) {
        RouteValueDictionary dictionary = routeValues != <span class="kwrd">null</span> ? <span class="kwrd">new</span> RouteValueDictionary(routeValues)             : <span class="kwrd">new</span> RouteValueDictionary();
        <span class="kwrd">foreach</span> (var pair <span class="kwrd">in</span> helper.ViewContext.RouteData.Values) {
            <span class="kwrd">if</span> (!dictionary.ContainsKey(pair.Key)) {
                dictionary.Add(pair.Key, pair.Value);
            }
        }
        <span class="kwrd">if</span> (!<span class="kwrd">string</span>.IsNullOrEmpty(actionName)) {
            dictionary[<span class="str">&quot;action&quot;</span>] = actionName;
        }
        <span class="kwrd">if</span> (!<span class="kwrd">string</span>.IsNullOrEmpty(controllerName)) {
            dictionary[<span class="str">&quot;controller&quot;</span>] = controllerName;
        }
        helper.RenderRoute(dictionary);
    }

    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RenderRoute(<span class="kwrd">this</span> HtmlHelper helper, RouteValueDictionary routeValues) {
        var routeData = <span class="kwrd">new</span> RouteData();
        <span class="kwrd">foreach</span> (var pair <span class="kwrd">in</span> routeValues) {
            routeData.Values.Add(pair.Key, pair.Value);
        }
        HttpContextBase httpContext = <span class="kwrd">new</span> OverrideRequestHttpContextWrapper(HttpContext.Current);
        var context = <span class="kwrd">new</span> RequestContext(httpContext, routeData);
        <span class="kwrd">bool</span> validateRequest = helper.ViewContext.Controller.ValidateRequest;
        <span class="kwrd">new</span> RenderSubActionMvcHandler(context, validateRequest).ProcessRequestInternal(httpContext);
    }

    <span class="preproc">#region</span> Nested type: RenderSubActionMvcHandler

    <span class="kwrd">private</span> <span class="kwrd">class</span> RenderSubActionMvcHandler : MvcHandler {
        <span class="kwrd">private</span> <span class="kwrd">bool</span> _validateRequest;
        <span class="kwrd">public</span> RenderSubActionMvcHandler(RequestContext context, <span class="kwrd">bool</span> validateRequest) : <span class="kwrd">base</span>(context) {
            _validateRequest = validateRequest;
        }

        <span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> AddVersionHeader(HttpContextBase httpContext) {}

        <span class="kwrd">public</span> <span class="kwrd">void</span> ProcessRequestInternal(HttpContextBase httpContext) {
            AddVersionHeader(httpContext);
            <span class="kwrd">string</span> requiredString = RequestContext.RouteData.GetRequiredString(<span class="str">&quot;controller&quot;</span>);
            IControllerFactory controllerFactory = ControllerBuilder.Current.GetControllerFactory();
            IController controller = controllerFactory.CreateController(RequestContext, requiredString);
            <span class="kwrd">if</span> (controller == <span class="kwrd">null</span>)
            {
                <span class="kwrd">throw</span> <span class="kwrd">new</span> InvalidOperationException(<span class="kwrd">string</span>.Format(CultureInfo.CurrentUICulture,                     <span class="str">&quot;The IControllerFactory '{0}' did not return a controller for a controller named '{1}'.&quot;</span>,                     <span class="kwrd">new</span> <span class="kwrd">object</span>[] { controllerFactory.GetType(), requiredString }));
            }
            <span class="kwrd">try</span>
            {
                ((ControllerBase) controller).ValidateRequest = _validateRequest;
                controller.Execute(RequestContext);
            }
            <span class="kwrd">finally</span>
            {
                controllerFactory.ReleaseController(controller);
            }
        }
    }

    <span class="kwrd">private</span> <span class="kwrd">class</span> OverrideHttpMethodHttpRequestWrapper : HttpRequestWrapper {
        <span class="kwrd">public</span> OverrideHttpMethodHttpRequestWrapper(HttpRequest httpRequest) : <span class="kwrd">base</span>(httpRequest) { }

        <span class="kwrd">public</span> <span class="kwrd">override</span> <span class="kwrd">string</span> HttpMethod {
            get { <span class="kwrd">return</span> <span class="str">&quot;GET&quot;</span>; }
        }
    }

    <span class="kwrd">private</span> <span class="kwrd">class</span> OverrideRequestHttpContextWrapper : HttpContextWrapper {
        <span class="kwrd">private</span> <span class="kwrd">readonly</span> HttpContext _httpContext;
        <span class="kwrd">public</span> OverrideRequestHttpContextWrapper(HttpContext httpContext) : <span class="kwrd">base</span>(httpContext) {
            _httpContext = httpContext;
        }

        <span class="kwrd">public</span> <span class="kwrd">override</span> HttpRequestBase Request {
            get { <span class="kwrd">return</span> <span class="kwrd">new</span> OverrideHttpMethodHttpRequestWrapper(_httpContext.Request); }
        }
    }

    <span class="preproc">#endregion</span>
}</pre>
<style type="text/css">
<p>.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; }</style>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.captaincodeman.com/2009/02/21/rendersubaction-alternative-to-renderaction-for-sub-controllers-in-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

