<?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>Adventures With .Net &#187; asp mvc</title>
	<atom:link href="http://adventureswith.net/tag/asp-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://adventureswith.net</link>
	<description>C# and the like</description>
	<lastBuildDate>Tue, 15 Nov 2011 15:34:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Asp.Net MVC3 Razor and RESX Localisations/Localizations</title>
		<link>http://adventureswith.net/asp-net-mvc3-razor-and-resx-localisationslocalizations/</link>
		<comments>http://adventureswith.net/asp-net-mvc3-razor-and-resx-localisationslocalizations/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 19:11:48 +0000</pubDate>
		<dc:creator>Dann</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[asp mvc]]></category>
		<category><![CDATA[localisation]]></category>
		<category><![CDATA[resx]]></category>

		<guid isPermaLink="false">http://adventureswith.net/?p=256</guid>
		<description><![CDATA[I was just applying for a small two week contract that was based on Localisation. This is the work I did to give myself a quick refresh. It reminded me on how well Asp.Net MVC3 works with RESX localisations. As &#8230; <a href="http://adventureswith.net/asp-net-mvc3-razor-and-resx-localisationslocalizations/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="rw-left"><div class="rw-ui-container rw-class-blog-post rw-urid-2570"></div></div><p><em>I was just applying for a small two week contract that was based on Localisation. This is the work I did to give myself a quick refresh. It reminded me on how well Asp.Net MVC3 works with RESX localisations.</em></p>
<p><a href="http://adventureswith.net/wp-content/uploads/2011/11/image4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://adventureswith.net/wp-content/uploads/2011/11/image_thumb4.png" width="229" height="244"></a>As a start, you will need someway to change your Local Language quickly. My preferred choice is using the <a href="https://addons.mozilla.org/en-US/firefox/addon/quick-locale-switcher/">Quick Locale Switcher for Firefox</a> which is in the image. </p>
<p>I have (over the last few hours) built up a fully translated version of the default MVC3 project which is viewable at <a title="RESX Examples" href="http://resxstuff.adventureswith.net"><strong>http://resxstuff.adventureswith.net</strong></a> and is viewable as 2 languages available English (Which is default) and French (which is terribly translated BTW).</p>
<h2>Turn On The World – Enable Globalisation</h2>
<p>To enable globalisation, you will need to add this line to your web.config&nbsp; in the &lt;system.web&gt;&lt;/system.web&gt; section:</p>
<pre class="brush: xhtml; toolbar: false">&lt;globalization uiCulture="auto" culture="auto"/&gt;</pre>
<h2>Add the RESX files; and let the class be seen</h2>
<p>If you are coming from Web Forms, note that for MVC you DO NOT HAVE TO (and perhaps should not) add your RESX to App_GlobalResourses or even App_LocalResources.</p>
<p>Just add them wherever you want and they can still be used, but only if you do the following:</p>
<ul>
<li>When you add<span id="more-256"></span>a new RESX, Change the Access Modifier to Public </li>
</ul>
<p>Otherwise you will be wondering why your resources don’t show up.</p>
<p><a href="http://adventureswith.net/wp-content/uploads/2011/11/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2011/11/image_thumb.png" width="709" height="380"></a></p>
<p><a href="http://adventureswith.net/wp-content/uploads/2011/11/image3.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="left" src="http://adventureswith.net/wp-content/uploads/2011/11/image_thumb3.png" width="153" height="176"></a>I followed the advice given by a few others to use the “RESX to a View” method, where you mimic the View folder structure within the Resources folder; as seen in the picture.</p>
<p>This usually means it is fairly easy to find the right file for the string that you want to change in a hurry.</p>
<p>&nbsp;</p>
<h2>Views – Changing out the text</h2>
<p>I went through all the views and changed every “message to the user” into a string resource in a RESX file.</p>
<p>All the <strong>Html.LabelFor </strong>calls were replaced with resources calls<br />e.g. <strong>@Html.LabelFor (x =&gt; x.Username) </strong>became<strong> @Resources.Account.Register.Username</strong></p>
<p>All boilerplate text was replaced with Resources e.g. “Login was unsuccessful. Please correct the errors and try again.” was pulled out of <em>LogOn.cshtml</em> and moved to <em>Resources.Account.LogOn.Login_Unsuccessful</em></p>
<pre>@Html.ValidationSummary(true, Resources.Account.LogOn.Login_Unsuccessful)</pre>
<h2>Controllers – Fixing up user messages</h2>
<p>Essentially controllers are the same deal as the views. Take the static text, place it in a RESX file where it makes sense.</p>
<p>I used the files related to the views that were to be returned e.g. If an action method returned the Logon view, then I used the Logon.resx file for that text.</p>
<pre class="brush: c-sharp; toolbar: false">using Resources;

....
....
....
[HttpPost]
       public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }

       private static string ErrorCodeToString(MembershipCreateStatus createStatus)
        {
            // See http://go.microsoft.com/fwlink/?LinkID=177550 for
            // a full list of status codes.
            switch (createStatus)
            {
                case MembershipCreateStatus.DuplicateUserName:
                    return ErrorStrings.Username_Exists;  //these are the resource strings
                case MembershipCreateStatus.DuplicateEmail:
                    return ErrorStrings.Email_Exists;
                case MembershipCreateStatus.InvalidPassword:
                    return ErrorStrings.Invalid_Password;
                case MembershipCreateStatus.InvalidEmail:
                    return ErrorStrings.Invalid_Email;
                case MembershipCreateStatus.InvalidAnswer:
                    return ErrorStrings.Invalid_Answer;
                case MembershipCreateStatus.InvalidQuestion:
                    return ErrorStrings.Invalid_Question;
                case MembershipCreateStatus.InvalidUserName:
                    return ErrorStrings.Invalid_Username;
                case MembershipCreateStatus.ProviderError:
                    return ErrorStrings.Provider_Error;
                case MembershipCreateStatus.UserRejected:
                    return ErrorStrings.User_Rejected;
                default:
                    return ErrorStrings.Default_Error;
            }
        }
</pre>
<h2>Models &amp; Validation</h2>
<p>The only tricky part is this one. And it’s not even that tricky.</p>
<p>Instead of where you would normally put <em>ErrorMessage=”Something bad happened here”</em>, you would instead point it the RESX files.</p>
<p>All of the Validation attributes have the Properties <em>ErrorMessageResourceType</em> and <em>ErrorMessageResourceName</em> which are explained as follows:</p>
<ul>
<li>ErrorMessageResourceType – Points to the resource file type
<li>ErrorMessageResourceName – Points to the KEY within that resource file </li>
</ul>
<p>It is sad that the key is not strongly typed, like in the rest of the code; this is the annoying nature of attributes.</p>
<p>So here we have the example of a model with resource friendly validation:</p>
<pre class="brush: c-sharp; toolbar: false">public class LogOnModel     {      

[Required(ErrorMessageResourceType = typeof(ErrorStrings), ErrorMessageResourceName = "Required")]
public string UserName { get; set; }         

[Required(ErrorMessageResourceType = typeof(ErrorStrings), ErrorMessageResourceName = "Required")]
[DataType(DataType.Password)]
public string Password { get; set; }  

}</pre>
<h2>RESX &#8211; Adding more languages</h2>
<p>So now you have all the files in place to use the RESX files that have been created as you went along.</p>
<p>Adding RESX files for other languages is easy. Just copy, paste, rename and it works.</p>
<p>The naming convention is as follows (from lowest to highest priority):</p>
<ul>
<li>Default &#8211; mytranslation.resx
<li>Language &#8211; mytranslation.en.resx&nbsp; or mytranslation.fr.resx
<li>Regional &#8211; mytranslation.en-GB.resx or mytranslation.en-US.resx </li>
</ul>
<p>So how do you create these for more languages? Luckily there is a fantastic free opensource tool that is available. <a href="http://resxtranslator.codeplex.com/">ResxTranslator from Codeplex</a> is able to read all your RESX files in the project and help you out by creating the other languages.</p>
<p>After they are created, just include them in the project.</p>
<p><em>Just a note</em> that I haven’t been able to create another language from inside ResxTranslator, by which I mean add a language that doesn’t already exist somewhere in the resx files already.</p>
<p>First, I have to first create a file with the language in the filename, as shown above, for it to show up as an option in the “Add Language” tool. But once I have added a language/dialect for one RESX, it is available for all files. Maybe I am missing something here.</p>
<p><a href="http://adventureswith.net/wp-content/uploads/2011/11/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2011/11/image_thumb2.png" width="626" height="372"></a></p>
<h2>Further Reading</h2>
<p>Nadeem Afana &#8211; Internationalising MVC3<br /><a href="http://afana.me/post/aspnet-mvc-internationalization.aspx">http://afana.me/post/aspnet-mvc-internationalization.aspx</a></p>
<p><span style="font-size: small"><font size="3">K. Scott Allen &#8211; Resource Files and ASP.NET MVC Projects</font></span><span style="font-size: small"><br /></span><a href="http://odetocode.com/Blogs/scott/archive/2009/07/16/resource-files-and-asp-net-mvc-projects.aspx"><span style="font-size: small"><font size="3">http://odetocode.com/Blogs/scott/archive/2009/07/16/resource-files-and-asp-net-mvc-projects.aspx</font></span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://adventureswith.net/asp-net-mvc3-razor-and-resx-localisationslocalizations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Common.Logging with Glimpse and ASP.Net MVC</title>
		<link>http://adventureswith.net/using-common-logging-with-glimpse-and-asp-net-mvc/</link>
		<comments>http://adventureswith.net/using-common-logging-with-glimpse-and-asp-net-mvc/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 10:24:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[asp mvc]]></category>
		<category><![CDATA[glimpse]]></category>
		<category><![CDATA[nuget]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://adventureswith.net/using-common-logging-with-glimpse-and-asp-net-mvc/</guid>
		<description><![CDATA[Glimpse is an amazing tool (that comes available with Nuget in Visual Studio 2010 [included in the Tools Update]) that can hook into the System.Diagnostic.Trace (ewww) to display error messages on your client side browser. Like so: I don’t want &#8230; <a href="http://adventureswith.net/using-common-logging-with-glimpse-and-asp-net-mvc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="rw-left"><div class="rw-ui-container rw-class-blog-post rw-urid-2360"></div></div><p><a href="http://nuget.org/List/Packages/Glimpse">Glimpse</a> is an amazing tool (that comes available with <a href="http://nuget.org/">Nuget</a> in Visual Studio 2010 [<a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=82cbd599-d29a-43e3-b78b-0f863d22811a&amp;displaylang=en">included in the Tools Update</a>]) that can hook into the System.Diagnostic.Trace (ewww) to display error messages on your client side browser. Like so:</p>
<p><a href="http://adventureswith.net/wp-content/uploads/2011/04/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2011/04/image_thumb.png" width="543" height="327"></a></p>
<p><em>I don’t want to use System.Diagnostics as my Logging system</em>. I could use it on the side, but not as the core. This would be awful and much too rigid. The good thing is, I typically use Common.Logging in all my projects because of it’s way to tie ANY LOGGING SYSTEM into a single point then ship those events off to any other receiving system. The receiving system in this case, is&nbsp; of course, System.Diagnostics.Trace using the TraceLoggerFactoryAdapter</p>
<p><span style="text-decoration: underline">So to get to the point above this is what I did:</span></p>
<ol>
<li>Using Create a new MVC project in VS2010
<li>Nuget
<ol>
<li>Install-Package Glimpse
<li>Install-Package Common.Logging </li>
</ol>
<li>Add Common.Logging&nbsp; to the web config
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:ac4b2b10-3d7b-4171-9cb7-1428e06708a2" class="wlWriterEditableSmartContent">
<pre style=" width: 510px; height: 300px;background-color:White;overflow: auto;">
<div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)

http://www.CodeHighlighter.com/

--><span style="color: #008000;">&lt;!--</span><span style="color: #008000;">...config sections... </span><span style="color: #008000;">--&gt;</span><span style="color: #000000;">
</span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">sectionGroup </span><span style="color: #FF0000;">name</span><span style="color: #0000FF;">=&quot;common&quot;</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
      </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">section </span><span style="color: #FF0000;">name</span><span style="color: #0000FF;">=&quot;logging&quot;</span><span style="color: #FF0000;"> type</span><span style="color: #0000FF;">=&quot;Common.Logging.ConfigurationSectionHandler, Common.Logging&quot;</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
</span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">sectionGroup</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;"> 

</span><span style="color: #008000;">&lt;!--</span><span style="color: #008000;">...configuration... </span><span style="color: #008000;">--&gt;</span><span style="color: #000000;">
</span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">common</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
    </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">logging</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
      </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">factoryAdapter </span><span style="color: #FF0000;">type</span><span style="color: #0000FF;">=&quot;Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e&quot;</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
        </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">arg </span><span style="color: #FF0000;">key</span><span style="color: #0000FF;">=&quot;level&quot;</span><span style="color: #FF0000;"> value</span><span style="color: #0000FF;">=&quot;ALL&quot;</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
        </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">arg </span><span style="color: #FF0000;">key</span><span style="color: #0000FF;">=&quot;showLogName&quot;</span><span style="color: #FF0000;"> value</span><span style="color: #0000FF;">=&quot;true&quot;</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
        </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">arg </span><span style="color: #FF0000;">key</span><span style="color: #0000FF;">=&quot;showDataTime&quot;</span><span style="color: #FF0000;"> value</span><span style="color: #0000FF;">=&quot;true&quot;</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
        </span><span style="color: #0000FF;">&lt;</span><span style="color: #800000;">arg </span><span style="color: #FF0000;">key</span><span style="color: #0000FF;">=&quot;dateTimeFormat&quot;</span><span style="color: #FF0000;"> value</span><span style="color: #0000FF;">=&quot;yyyy/MM/dd HH:mm:ss:fff&quot;</span><span style="color: #FF0000;"> </span><span style="color: #0000FF;">/&gt;</span><span style="color: #000000;">
      </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">factoryAdapter</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
    </span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">logging</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
</span><span style="color: #0000FF;">&lt;/</span><span style="color: #800000;">common</span><span style="color: #0000FF;">&gt;</span><span style="color: #000000;">
</span></div>
</pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
<li>Add some “problems”<a href="http://adventureswith.net/wp-content/uploads/2011/04/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2011/04/image_thumb1.png" width="469" height="337"></a>
<li>Run the project and go to http://[your project url]/Gimpse/Configthen click “Turn Glimpse On”. Don’t be surprised that nothing happens.
<p><a href="http://adventureswith.net/wp-content/uploads/2011/04/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2011/04/image_thumb2.png" width="438" height="431"></a></p>
<li>Go to your main page http://[your project url]/ – See the icon in the right hand corner? Click that.<br /><a href="http://adventureswith.net/wp-content/uploads/2011/04/image3.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2011/04/image_thumb3.png" width="451" height="257"></a>
<li>Look at those errors! </li>
</ol>
<p><a href="http://adventureswith.net/wp-content/uploads/2011/04/image4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2011/04/image_thumb4.png" width="500" height="302"></a></p>
<h2><span style="color: #000000">Conclusion?</span></h2>
<p>Amazing! The guys who made Glimpse deserve some sort of medal!</p>
]]></content:encoded>
			<wfw:commentRss>http://adventureswith.net/using-common-logging-with-glimpse-and-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting MVC 2 RC to MVC 2 RTM</title>
		<link>http://adventureswith.net/converting-mvc-2-rc-to-mvc-2-rtm/</link>
		<comments>http://adventureswith.net/converting-mvc-2-rc-to-mvc-2-rtm/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 16:24:03 +0000</pubDate>
		<dc:creator>Dann</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[asp mvc]]></category>
		<category><![CDATA[conversion]]></category>

		<guid isPermaLink="false">http://AdventuresWith.Net/converting-mvc-2-rc-to-mvc-2-rtm/</guid>
		<description><![CDATA[Ok, this is more of a hack than a true conversion, but I haven&#8217;t noticed the difference… yet. Remember to back up what you’re not willing to lose! Remove your MVC project from your solution. Don’t delete, just remove. Then &#8230; <a href="http://adventureswith.net/converting-mvc-2-rc-to-mvc-2-rtm/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="rw-left"><div class="rw-ui-container rw-class-blog-post rw-urid-1100"></div></div><p>Ok, this is more of a hack than a true conversion, but I haven&#8217;t noticed the difference… yet.</p>
<p>Remember to back up what you’re not willing to lose! </p>
<ol>
<li>Remove your MVC project from your solution. Don’t delete, just remove. Then save all (Shift-Ctrl-S)</li>
<li>Edit your MVC project *.csproj file and change the ProjectTypeGuids to:     <br />&lt;ProjectTypeGuids&gt;{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}&lt;/ProjectTypeGuids&gt;<a href="http://adventureswith.net/wp-content/uploads/2010/03/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://adventureswith.net/wp-content/uploads/2010/03/image_thumb.png" width="531" height="166" /></a>      </li>
<li>Add your project back into your solution and save everything</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://adventureswith.net/converting-mvc-2-rc-to-mvc-2-rtm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asp.Net MVC 2 Action Results</title>
		<link>http://adventureswith.net/asp-net-mvc-2-action-results/</link>
		<comments>http://adventureswith.net/asp-net-mvc-2-action-results/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 14:00:05 +0000</pubDate>
		<dc:creator>Dann</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[asp mvc]]></category>

		<guid isPermaLink="false">http://AdventuresWith.Net/?p=33</guid>
		<description><![CDATA[A handy list of ActionResult’s that I found on StackOverflow thanks to Chris.S and his reference to the MSDN doc. ContentResult Writes a string value directly into the HTTP response. EmptyResult Does not write to the HTTP response. FileContentResult Takes &#8230; <a href="http://adventureswith.net/asp-net-mvc-2-action-results/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="rw-left"><div class="rw-ui-container rw-class-blog-post rw-urid-340"></div></div><p>A handy list of ActionResult’s that <a href="http://stackoverflow.com/questions/1267043/all-inbuilt-actionresults-in-asp-net-mvc" target="_blank">I found on StackOverflow</a> thanks to Chris.S and his reference to the <a href="http://msdn.microsoft.com/en-us/magazine/dd695917.aspx" target="_blank">MSDN doc</a>.</p>
<p><strong>ContentResult</strong>    <br />Writes a string value directly into the HTTP response.</p>
<p><strong>EmptyResult</strong>    <br />Does not write to the HTTP response. </p>
<p><strong>FileContentResult</strong>    <br />Takes the contents of a file (represented as an array of bytes) and write the contents into the HTTP response.</p>
<p><strong>FilePathResult</strong>    <br />Takes the contents of a file at the given location and writes the contents into the HTTP response.</p>
<p><strong>FileStreamResult</strong>    <br />Takes a file stream produced by the controller and writes the stream into the HTTP response.</p>
<p><strong>HttpUnauthorizedResult</strong>    <br />A special result used by authorization filters when authorization checks fail. </p>
<p><strong>JavaScriptResult</strong>    <br />Responds to the client with a script for the client to execute.</p>
<p><strong>JsonResult</strong>    <br />Responds to the client with data in JavaScript Object Notation (JSON).</p>
<p><strong>RedirectResult</strong>    <br />Redirects the client to a new URL.</p>
<p><strong>RedirectToRouteResult</strong>    <br />Renders the specified view to respond with an HTML fragment (typically used in AJAX scenarios).</p>
<p><strong>PartialViewResult</strong>    <br />Renders the specified view to respond with an HTML fragment (typically used in AJAX scenarios).</p>
<p><strong>ViewResult</strong>    <br />Renders the specified view and responds to the client with HTML.</p>
]]></content:encoded>
			<wfw:commentRss>http://adventureswith.net/asp-net-mvc-2-action-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

