<?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>Error On Line One</title>
	<atom:link href="http://www.erroronlineone.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.erroronlineone.com</link>
	<description>Something goes here</description>
	<lastBuildDate>Wed, 14 Sep 2011 00:14:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Protip: Always Check the Scripts</title>
		<link>http://www.erroronlineone.com/2011/09/13/protip-always-check-the-scripts/</link>
		<comments>http://www.erroronlineone.com/2011/09/13/protip-always-check-the-scripts/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 00:14:12 +0000</pubDate>
		<dc:creator>Billy</dc:creator>
				<category><![CDATA[Something I Learned Today]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.erroronlineone.com/?p=127</guid>
		<description><![CDATA[I had to update a site with a slideshow. But when I added the HTML, CSS and JavaScript and the slideshow just didn&#8217;t work I kept banging my head on my keyboard trying to figure out why. I&#8217;m checking the &#8230; <a href="http://www.erroronlineone.com/2011/09/13/protip-always-check-the-scripts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had to update a site with a slideshow.</p>
<p>But when I added the HTML, CSS and JavaScript and the slideshow just didn&#8217;t work I kept banging my head on my keyboard trying to figure out <strong>why.</strong> I&#8217;m checking the examples. I&#8217;m removing CSS and other JavaScript code to see if there&#8217;s some kind of conflict and nothing.</p>
<p><em>Well, let me literally copy the the scripts from the example</em> because they were full-pathed, and hey the slideshow started working.</p>
<p>Turns out that when I set the site up, I used the <a href="http://html5boilerplate.com/">HTML5 Boilerplate</a> which I believe had jQuery 1.4 and the slideshow used jQuery 1.5. Well, there&#8217;s your problem.</p>
<p>Lesson learned, always check your script versions, or always make sure you just use the latest versions (which I normally do but for this site I didn&#8217;t, I think because there was another larger project that needed finishing and this one just fell out of thin air).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.erroronlineone.com/2011/09/13/protip-always-check-the-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC3 Display an Asterisk For Error Message</title>
		<link>http://www.erroronlineone.com/2011/09/12/mvc3-display-an-asterisk-for-error-message/</link>
		<comments>http://www.erroronlineone.com/2011/09/12/mvc3-display-an-asterisk-for-error-message/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 01:35:56 +0000</pubDate>
		<dc:creator>Billy</dc:creator>
				<category><![CDATA[Something I Learned Today]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC3]]></category>

		<guid isPermaLink="false">http://www.erroronlineone.com/?p=96</guid>
		<description><![CDATA[So with when working with MVC3 you can decorate your POCO&#8217;s with attributes that can be used to validate the properties on both the server and client side. It makes validation easy. But what if you don&#8217;t really have the &#8230; <a href="http://www.erroronlineone.com/2011/09/12/mvc3-display-an-asterisk-for-error-message/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So with when working with MVC3 you can decorate your POCO&#8217;s <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.aspx">with attributes</a> that can be used to validate the properties on both the server and client side. It makes validation easy.</p>
<p>But what if you don&#8217;t really have the space to display the error messages next to the field and would rather have something shorter like an asterisk?</p>
<p>Turns out the <a href="http://msdn.microsoft.com/en-us/library/gg401877%28v=VS.98%29.aspx">ValidationMessageFor</a> HtmlHelper takes a parameter for validationMessage which overrides the ErrorMessage from the model.</p>
<p>The POCO and a strongly typed view:</p>
<pre class="brush: cpp; title: ; notranslate">

using System.ComponentModel.DataAnnotations;

namespace MvcApplication3.Models
{
    public class Person
    {
        [Required(ErrorMessage = &quot;The name is required&quot;)]
        public string Name { get; set; }

        [Required(ErrorMessage = &quot;The title is required&quot;)]
        public string Title { get; set; }
    }
}
</pre>
<p><img class="alignnone size-medium wp-image-113" title="mvc3-errormessagefor-default" src="/wp-content/uploads/2011/09/mvc3-errormessagefor-default-300x185.png" alt="" width="300" height="185" /></p>
<p>Then update your view&#8217;s ValidationMessageFor with a second parameter, a string containing your new error message.</p>
<pre class="brush: cpp; title: ; notranslate">
@Html.ValidationMessageFor(model =&gt; model.Name, &quot;*&quot;)
</pre>
<p><img class="alignnone size-medium wp-image-112" title="mvc3-errormessagefor-custom" src="/wp-content/uploads/2011/09/mvc3-errormessagefor-custom-300x185.png" alt="" width="300" height="185" /></p>
<p>And if you want to display a list of the error messages set the <a href="http://msdn.microsoft.com/en-us/library/ee839469.aspx">ValidationSummary</a> parameter to false (display all errors):</p>
<pre class="brush: cpp; title: ; notranslate">
@Html.ValidationSummary(false)
</pre>
<p><img class="alignnone size-medium wp-image-111" title="mvc3-errormessagefor-summary" src="/wp-content/uploads/2011/09/mvc3-errormessagefor-summary-300x259.png" alt="" width="300" height="259" /></p>
<p>One more thing, if you are using your own style sheet, our custom errors are displaying:</p>
<p><img class="alignnone size-full wp-image-110" title="mvc3-errormessagefor-unstyled" src="/wp-content/uploads/2011/09/mvc3-errormessagefor-unstyled.png" alt="" width="245" height="171" /></p>
<p>We just have to hide the custom error messages from view until someone tries to submit the form with one CSS class.</p>
<pre class="brush: css; title: ; notranslate">
.field-validation-valid
{
    display: none;
}
</pre>
<p>Source for the CSS: <a href="http://stackoverflow.com/questions/4370131/asp-net-mvc-3-rc-razor-validationmessagefor-custommessage-and-clientsidevalidat">http://stackoverflow.com/questions/4370131/asp-net-mvc-3-rc-razor-validationmessagefor-custommessage-and-clientsidevalidat</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.erroronlineone.com/2011/09/12/mvc3-display-an-asterisk-for-error-message/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebMail Helper and SMTP MailSettings</title>
		<link>http://www.erroronlineone.com/2011/09/06/webmail-helper-and-smtp-mailsettings/</link>
		<comments>http://www.erroronlineone.com/2011/09/06/webmail-helper-and-smtp-mailsettings/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 02:10:47 +0000</pubDate>
		<dc:creator>Billy</dc:creator>
				<category><![CDATA[Something I Learned Today]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Razor]]></category>
		<category><![CDATA[WebConfig]]></category>
		<category><![CDATA[WebMail]]></category>

		<guid isPermaLink="false">http://www.erroronlineone.com/?p=86</guid>
		<description><![CDATA[I had to add some email notification to a project today and wanted to give the new WebMail helper a try. It&#8217;s a pretty straight forward chunk of code that makes sending emails really easy. They only thing I couldn&#8217;t &#8230; <a href="http://www.erroronlineone.com/2011/09/06/webmail-helper-and-smtp-mailsettings/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had to add some email notification to a project today and wanted to give the new <a href="http://msdn.microsoft.com/en-us/library/gg547987%28v=VS.99%29.aspx">WebMail helper</a> a try.</p>
<p>It&#8217;s a pretty straight forward chunk of code that makes sending emails really easy. They only thing I couldn&#8217;t find was anything about using the web.config to set your smtp settings like host and port number. However the MSDN documentation says you can just use the _AppStart.cshtml (and when you create a Razor website the _AppStart.cshtml has the WebMail settings in it, just commented out).</p>
<blockquote><p>Many of the property values (like the SMTP server name and port number) are usually constant for a website. Therefore, you typically make many of these property settings only one time in the _AppStart.cshtml or _AppStart.vbhtml file that runs when the website first runs.</p></blockquote>
<p>But I just wanted to see about setting it in the web.config, to try to keep my settings together in one file.</p>
<p>It turns out that simply setting the settings in system.net in the web.config is enough:</p>
<pre class="brush: xml; title: ; notranslate">
  &lt;system.net&gt;
    &lt;mailSettings&gt;
      &lt;smtp&gt;
        &lt;network host=&quot;localhost&quot; port=&quot;25&quot;/&gt;
      &lt;/smtp&gt;
    &lt;/mailSettings&gt;
  &lt;/system.net&gt;
</pre>
<p>Then sending your email with the WebMail helper is just the same:</p>
<pre class="brush: cpp; title: ; notranslate">
@{
  try
  {
    WebMail.Send(&quot;test@test.com&quot;, &quot;Test Message&quot;, &quot;Hello world!&quot;);
  }
  catch(Exception ex)
  {
    @ex.Message
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.erroronlineone.com/2011/09/06/webmail-helper-and-smtp-mailsettings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS Large File Upload Error</title>
		<link>http://www.erroronlineone.com/2011/09/02/iis-large-file-upload-error/</link>
		<comments>http://www.erroronlineone.com/2011/09/02/iis-large-file-upload-error/#comments</comments>
		<pubDate>Sat, 03 Sep 2011 03:18:37 +0000</pubDate>
		<dc:creator>Billy</dc:creator>
				<category><![CDATA[Something I Learned Today]]></category>
		<category><![CDATA[File Upload]]></category>
		<category><![CDATA[IIS 7]]></category>
		<category><![CDATA[IIS Express]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.erroronlineone.com/?p=71</guid>
		<description><![CDATA[So you want to let someone upload something to your server using ASP.NET MVC. Not a big problem, pretty simple. But what happens if someone tries to upload a large file? The default max upload file size is four megabytes. &#8230; <a href="http://www.erroronlineone.com/2011/09/02/iis-large-file-upload-error/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So you want to let someone upload something to your server using ASP.NET MVC. <a href="http://stackoverflow.com/questions/5193842/file-upload-asp-net-mvc3-0">Not a big problem, pretty simple.</a> But what happens if someone tries to upload a large file?</p>
<p><img class="alignleft" title="connection-reset" src="/assets/connection-reset-300x154.png" alt="" width="300" height="154" /></p>
<p>The default max upload file size is four megabytes. Anything larger and you receive that message. Of course you could set the maxRequestLength in the web.config but the problem with that is that we didn&#8217;t deal with the problem.</p>
<p>We don&#8217;t just want to put the problem out of mind and hope that no one uploads more than that, but we want to have some control over how much someone can upload to our server and if they try to upload more than our limit handle it properly.</p>
<p>This is the basic settings for the webconfig to handle a <a href="http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits">404.13 error</a>.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;system.webServer&gt;
	&lt;httpErrors errorMode=&quot;Custom&quot; existingResponse=&quot;Replace&quot;&gt;
		&lt;error statusCode=&quot;404&quot; subStatusCode=&quot;13&quot; path=&quot;/Home/Error&quot; responseMode=&quot;Redirect&quot; /&gt;
	&lt;/httpErrors&gt;
&lt;/system.webServer&gt;
</pre>
<p>There are some additional settings and information available on <a href="http://stackoverflow.com/questions/2759193/display-custom-error-page-when-file-upload-exceeds-allowed-size-in-asp-net-mvc">Display custom error page when file upload exceeds allowed size in ASP.NET MVC</a>.</p>
<p>But there is just one problem, it doesn&#8217;t work. Well it does. Just not with Visual Studio development server.</p>
<p>To fix the issue either run the site under IIS proper or just set Visual Studio to use IIS Express by right clicking the project name and select the option from the context menu.</p>
<p><img class="alignnone size-medium wp-image-76" title="use-iis-express" src="/assets/use-iis-express-300x272.png" alt="" width="300" height="272" /></p>
<p>After that run the project and try to upload a file larger than four megabytes (or whatever you set it to) and you should receive your custom error page.</p>
<p><img class="alignnone size-medium wp-image-75" title="error" src="/assets/error-300x176.png" alt="" width="300" height="176" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.erroronlineone.com/2011/09/02/iis-large-file-upload-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC3 Account/Login</title>
		<link>http://www.erroronlineone.com/2011/09/01/mvc3-accountlogin/</link>
		<comments>http://www.erroronlineone.com/2011/09/01/mvc3-accountlogin/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 01:21:23 +0000</pubDate>
		<dc:creator>Billy</dc:creator>
				<category><![CDATA[Something I Learned Today]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC3]]></category>

		<guid isPermaLink="false">http://www.erroronlineone.com/?p=64</guid>
		<description><![CDATA[I want to start off with something simple, to make posting easier. Something along the lines of learning something new every day, or Something I Learned Today. Today I was working on a MVC3 project and for some reason on &#8230; <a href="http://www.erroronlineone.com/2011/09/01/mvc3-accountlogin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I want to start off with something simple, to make posting easier. Something along the lines of learning something new every day, or <em>Something I Learned Today</em>.</p>
<p>Today I was working on a MVC3 project and for some reason on of resources that required authentication was looking for /Account/Login.</p>
<p>I couldn&#8217;t find anything, even searching the entire project for <em>Login</em>. Worst case I just created the Login action in the Account controller and did a redirect to the LogOn action.</p>
<p>But a little more Googling I found:<a href="http://www.britishdeveloper.co.uk/2011/06/two-bugs-in-aspnet-mvc-3-and-workaround.html"> Two bugs in ASP.NET MVC 3 and a workaround for both</a></p>
<p>The solution is to add the following app setting to the web.config:</p>
<pre class="brush: xml; title: ; notranslate">

&lt;add key=&quot;loginUrl&quot; value=&quot;~/Account/LogOn&quot;/&gt;
</pre>
<p>I created a new project at home to test to see if this is a normal thing and the good news is that it&#8217;s not. So it must just be my one resource in my project at work. But know I know how to fix the issue for the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.erroronlineone.com/2011/09/01/mvc3-accountlogin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

