<?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>ASP.NET 4.5 Hosting News (SuperBlogAds Network)</title>
	<atom:link href="http://www.aspnethostingnews.com/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.aspnethostingnews.com</link>
	<description>News about ASP.NET 4.5 Hosting, ASP.NET 4.0 Hosting, ASP.NET 3.5 Hosting, &#38; ASP.NET Hosting</description>
	<lastBuildDate>Thu, 10 May 2012 06:44:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ASP.NET 4 Hosting :: How to Fix &#8211; HTTP Error 403.14 &#8220;Forbidden The Web server is configured to not list the contents of this directory&#8221;</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1287</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1287#comments</comments>
		<pubDate>Thu, 10 May 2012 06:44:00 +0000</pubDate>
		<dc:creator>Stephen Jackson</dc:creator>
				<category><![CDATA[ASP.NET 4.0 Hosting]]></category>
		<category><![CDATA[.net 4 hosting]]></category>
		<category><![CDATA[.net hosting]]></category>
		<category><![CDATA[asp.net 4 hosting]]></category>
		<category><![CDATA[cheap .net 4 hosting]]></category>
		<category><![CDATA[cheap asp.net 4 hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1287</guid>
		<description><![CDATA[<p>We had a fresh install of Windows 2008 and Visual Studio 2010 on a developers machine that was getting this error when trying to access a MVC 2.0 .Net 4.0 website hosted locally on IIS7. Various fixes talk about making sure there is a default document, and also about turning on directory browsing, but neither of <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1287">ASP.NET 4 Hosting :: How to Fix &#8211; HTTP Error 403.14 &#8220;Forbidden The Web server is configured to not list the contents of this directory&#8221;</a></span>]]></description>
			<content:encoded><![CDATA[<p>We had a fresh install of Windows 2008 and Visual Studio 2010 on a developers machine that was getting this error when trying to access a MVC 2.0 .Net 4.0 website hosted locally on IIS7. Various fixes talk about making sure there is a default document, and also about turning on directory browsing, but neither of those work. (MVC 2.0 does not need a default document specified).</p>
<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p>The issue was that .Net framework 4.0 had not installed correctly, so here is what you need to do to fix it.</p>
<p>1.) Run a command prompt as Administrator.</p>
<p>2.) Copy and paste the following text “C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i”</p>
<p>This is assuming that you have already installed MVC 2.0 And .Net Framework 4.0 , but not in the correct order.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1287/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 3 Hosting :: Async jQuery Progress Indicator for Long Running Tasks ASP.NET MVC 3</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1280</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1280#comments</comments>
		<pubDate>Fri, 04 May 2012 02:43:10 +0000</pubDate>
		<dc:creator>Stephen Jackson</dc:creator>
				<category><![CDATA[ASP.NET MVC 3 Hosting]]></category>
		<category><![CDATA[asp.net mvc 3 hosting]]></category>
		<category><![CDATA[asp.net mvc 3.0 hosting]]></category>
		<category><![CDATA[ASP.NET MVC Hosting]]></category>
		<category><![CDATA[cheap asp.net mvc 3 hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>
		<category><![CDATA[mvc 3.0 hosting]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1280</guid>
		<description><![CDATA[<p>If you have long running (server side) tasks in your ASP.NET MVC 3 web application it could be reasonable to provide the user with information about the current progress of this task. In this blog post I will show how such a progress indicator could be implemented using jQuery and AJAX.</p>

<p>The basic idea is as follows: <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1280">ASP.NET MVC 3 Hosting :: Async jQuery Progress Indicator for Long Running Tasks ASP.NET MVC 3</a></span>]]></description>
			<content:encoded><![CDATA[<p>If you have long running (server side) tasks in your ASP.NET MVC 3 web application it could be reasonable to provide the user with information about the current progress of this task. In this blog post I will show how such a progress indicator could be implemented using jQuery and AJAX.</p>
<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p>The basic idea is as follows: Two actions exists on the server side; one action starts the (long running) task in a new thread and returns a unique identifier (GUID in this example) to the client and the second action returns the current (percentaged) status for a specific task. </p>
<p>For simplicity, in this example all (server side) functionality is implemented in the <em>HomeController</em>:</p>
<p><code><strong>public</strong> <strong>class</strong> HomeController : Controller<br />
{<br />
  <strong>private</strong> <strong>static</strong> IDictionary&lt;Guid, <strong>int</strong>&gt; tasks = new Dictionary&lt;Guid, <strong>int</strong>&gt;();</p>
<p>  <strong>public</strong> ActionResult Index()<br />
  {<br />
    <strong>return</strong> View();<br />
  }</p>
<p>  <strong>public</strong> ActionResult Start()<br />
  {<br />
    var taskId = Guid.NewGuid();<br />
    tasks.Add(taskId, 0);</p>
<p>    Task.Factory.StartNew(() =&gt;<br />
    {<br />
      <strong>for</strong> (var i = 0; i &lt;= 100; i++)<br />
      {<br />
        tasks[taskId] = i; <em>// update task progress</em><br />
        Thread.Sleep(50); <em>// simulate long running operation</em><br />
      }<br />
      tasks.Remove(taskId);<br />
    });</p>
<p>    <strong>return</strong> Json(taskId);<br />
  }</p>
<p>  <strong>public</strong> ActionResult Progress(Guid id)<br />
  {<br />
    <strong>return</strong> Json(tasks.Keys.Contains(id) ? tasks[id] : 100);<br />
  }<br />
}</code></p>
<p>The <em>HomeController</em> uses a Dictionary to save the progresses of all tasks. The <em>Start</em> action adds a new entry to this dictionary (with progress 0) and starts a new <em>Task</em> that simulates the long running operation. It is important to understand that this (time-consuming) operation is running in a separate thread and server immediately returns a result to the client (the unique identifier of the task), i.e. there is no HTTP request that is open as long as the task runs. The <em>Progress</em> action just returns the progress for a given GUID that uniquely identifies a task. Both actions return a JSON-result to enable easily processing of the data on the client side.</p>
<p>The client side functionality is implemented in the <em>Index.cshtml</em> view:</p>
<p><code>&lt;script type="text/javascript"&gt;</p>
<p><strong>function</strong> updateMonitor(taskId, status) {<br />
  $("#" + taskId).html("Task [" + taskId + "]: " + status);<br />
}</p>
<p>$(<strong>function</strong> () {<br />
  $("#start").click(<strong>function</strong> (e) {<br />
    e.preventDefault();<br />
    $.post("Home/Start", {}, <strong>function</strong> (taskId) {</p>
<p>      <em>// Init monitors</em><br />
      $("#monitors").append($("&lt;p id='" + taskId + "'/&gt;"));<br />
      updateMonitor(taskId, "Started");</p>
<p>      <em>// Periodically update monitors</em><br />
      <strong>var</strong> intervalId = setInterval(<strong>function</strong> () {<br />
        $.post("Home/Progress", { id: taskId }, <strong>function</strong> (progress) {<br />
          <strong>if</strong> (progress &gt;= 100) {<br />
            updateMonitor(taskId, "Completed");<br />
          clearInterval(intervalId);<br />
          } <strong>else</strong> {<br />
            updateMonitor(taskId, progress + "%");<br />
          }<br />
        });<br />
      }, 100);<br />
    });<br />
  });<br />
});<br />
&lt;/script&gt;</p>
<p>&lt;div&gt;&lt;/div&gt;</code></p>
<p>On the client side the jQuery function <em>$.post()</em> is used to</p>
<ul>
<li>first “call” the URL <em>Home/Start</em> to start a new task</li>
<li>and then periodically pass the returned GUID to the URL <em>Home/Progress</em> to get the current progress.</li>
</ul>
<p>To show some feedback to the user a <em>&lt;p&gt;</em> tag is created for each started task and periodically updated with the current progress.</p>
<p>Note: The approach shown above supports multiple parallel running tasks. You can click the “start” link while other task(s) are still running.</p>
<p>The code shown above is only exemplary. In a real-world project one should implement a robust error handling to support for example situations where the tasks are interrupted. Furthermore it could be reasonable to limit the number of parallel tasks one user could start, since long running tasks are often need much resources.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1280/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET 4.5 Hosting :: Control level request validation in ASP.NET 4.5</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1247</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1247#comments</comments>
		<pubDate>Fri, 27 Apr 2012 05:02:37 +0000</pubDate>
		<dc:creator>Wayne Plotche</dc:creator>
				<category><![CDATA[ASP.NET 4.5 Hosting]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[asp.net 4.5]]></category>
		<category><![CDATA[asp.net 4.5 hosting]]></category>
		<category><![CDATA[asp.net hosting]]></category>
		<category><![CDATA[cheap asp.net 4.5 hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1247</guid>
		<description><![CDATA[<p>Request validation in ASP.NET designed to protection against cross site against cross-site scripting (XSS) attacks. This features is available from the beginning days of ASP.NET. This gives your web sites a default protection to prevent XSS attacks. Check this post to know about fundamentals of ASP.NET Request validation. In this post I am going to talk <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1247">ASP.NET 4.5 Hosting :: Control level request validation in ASP.NET 4.5</a></span>]]></description>
			<content:encoded><![CDATA[<p>Request validation in ASP.NET designed to protection against cross site against <em>cross-site scripting (XSS)</em> attacks. This features is available from the beginning days of ASP.NET. This gives your web sites a default protection to prevent <em>XSS attacks</em>. <a href="http://www.asp.net/whitepapers/request-validation" target="_blank">Check this post</a> to know about fundamentals of ASP.NET Request validation. In this post I am going to talk about the changes of request validation in ASP.NET 4.5 Developer preview.</p>
<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p>ASP.NET request validation is turned on by default and prior to 4.5 it was a page level settings. Prior to ASP.NET 4.5 it was required to disable the validation for entire page in <strong>page</strong> directives using <strong>ValidateRequest</strong> attributes.</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_1.png"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_1.png" alt="" title="image_1" width="454" height="141" class="aligncenter size-full wp-image-1248" /></a></p>
<p>ASP.NET 4.5 introduced a nice enhancement in request validation with “<strong>Control Level Validation</strong>” . With ASP.NET 4.5 now you can disable the request validation for a specific control with a new properties “<strong>ValidateRequestMode</strong>” .</p>
<p>You can set <strong>ValidateRequestMode</strong> to either of below values</p>
<ul>
<li><strong>Disabled</strong></li>
<li><strong>Enabled</strong></li>
<li><strong>Inherits</strong>.</li>
</ul>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_2.png"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_2.png" alt="" title="image_2" width="523" height="104" class="aligncenter size-full wp-image-1249" /></a></p>
<p>Once you set the <strong>ValidateRequestMode</strong> properties for any control, ASP.NET runtime perform a lazy request validation for that specific control.</p>
<p>To enable this features you have to make sure <strong>requestValidationMode=”4.5″</strong> is set in <strong>httpRuntime</strong> section in the <strong>web.config</strong> file of your web application.</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_3.png"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_3.png" alt="" title="image_3" width="523" height="114" class="aligncenter size-full wp-image-1250" /></a></p>
<p>As shown in below picture, we have enabled and disabled the control validation for different control. We can also even set to inherit to take automatically from the parent control behaviors.</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_4.png"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_4.png" alt="" title="image_4" width="523" height="114" class="aligncenter size-full wp-image-1251" /></a></p>
<p>Hope this helps !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1247/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 3 Hosting :: Tips for Using HTML5 with ASP.NET MVC</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1237</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1237#comments</comments>
		<pubDate>Mon, 16 Apr 2012 03:51:09 +0000</pubDate>
		<dc:creator>Wayne Plotche</dc:creator>
				<category><![CDATA[ASP.NET MVC 3 Hosting]]></category>
		<category><![CDATA[asp.net mvc 3 hosting]]></category>
		<category><![CDATA[cheap asp.net mvc 3 hosting]]></category>
		<category><![CDATA[cheap asp.net mvc hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1237</guid>
		<description><![CDATA[<p>The mobile version of jQuery is due out in the next few weeks – it’s currently a release candidate – and I’m working on a project using it. I haven’t done much in the way of mobile development so far, as I’ve been kept permanently busy doing traditional Web development. However, the release of mobile jQuery, <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1237">ASP.NET MVC 3 Hosting :: Tips for Using HTML5 with ASP.NET MVC</a></span>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://jquerymobile.com/">mobile version of jQuery</a> is due out in the next few weeks – it’s currently a release candidate – and I’m working on a project using it. I haven’t done much in the way of mobile development so far, as I’ve been kept permanently busy doing traditional Web development. However, the release of mobile jQuery, and the massive uptake of mobile devices, means it’s time to get with the program. I’m learning a lot as I go, and I’ll be sharing anything I think is useful or interesting with you as the project progresses.</p>
<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p>The project combines jQuery mobile with HTML5, Entity Framework 4 and ASP.NET MVC3 (with Razor). I’m not using HTML5 on a whim, but because jQuery mobile relies on it – and that, in turn, made me turn automatically to ASP.NET MVC rather than ASP.NET Web Forms, as MVC lets you write all your own HTML. Having said which, there are some gotchas even with ASP.NET MVC – so here are a couple of tips to help you write HTML5 with ASP.NET MVC.</p>
<p>1. <em>Change Visual Studio’s default HTML validation</em></p>
<p>By default, Visual Studio validates your HTML as XHTML 1.0 Transitional. This will give you lots of annoying green underlining</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_11.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_11.jpg" alt="" title="image_1" width="285" height="63" class="aligncenter size-full wp-image-1238" /></a></p>
<p>You can get rid of the warnings (and get useful HTML5 validation) by going into Tools &gt; Options &gt; Text Editor &gt; HTML &gt; Validation and changing the target to HTML5.</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_21.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_21.jpg" alt="" title="image_2" width="472" height="276" class="aligncenter size-full wp-image-1239" /></a></p>
<p>2. <em>Use _ for – in data-*</em></p>
<p>ASP.NET MVC 3 allows you to pass in the hyphenated data-* HTML5 attributes using an underscore. It then automatically replaces the underscore with the hyphen. So that the following code</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_3.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_3.jpg" alt="" title="image_3" width="564" height="147" class="aligncenter size-full wp-image-1240" /></a></p>
<p>outputs this HTML:</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_4.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_4.jpg" alt="" title="image_4" width="868" height="117" class="aligncenter size-full wp-image-1241" /></a></p>
<p>which, when you’re using jQuery mobile on its default settings on a black footer, produces this rather elegant button:</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_5.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_5.jpg" alt="" title="image_5" width="128" height="64" class="aligncenter size-full wp-image-1242" /></a></p>
<p>And if you think that’s lacking in contrast, we can always add in another data-* element from jQuery mobile&#8230;</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_6.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_6.jpg" alt="" title="image_6" width="548" height="173" class="aligncenter size-full wp-image-1243" /></a></p>
<p>which gives us&#8230;</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_7.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_7.jpg" alt="" title="image_7" width="152" height="64" class="aligncenter size-full wp-image-1244" /></a></p>
<p>Of course, the _ for – substitution only works if you’re using ASP.NET MVC3 – which begs the question of what you can do if you’re still using ASP.NET MVC 2</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1237/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET 4.5 Hosting :: Streamlined Web Loading in the Visual Studio 2011</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1232</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1232#comments</comments>
		<pubDate>Tue, 10 Apr 2012 09:06:31 +0000</pubDate>
		<dc:creator>Wayne Plotche</dc:creator>
				<category><![CDATA[Visual Studio 2011 Hosting]]></category>
		<category><![CDATA[cheap visual studio 2011 hosting]]></category>
		<category><![CDATA[cheap vs 2011 hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>
		<category><![CDATA[visual studio 2011 hosting]]></category>
		<category><![CDATA[vs 2011 hosting]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1232</guid>
		<description><![CDATA[<p>One of the features of Visual Studio 11 that I’m really looking forward to taking advantage of is CSS and JavaScript minification and bundling.</p>
<p>As developers, we like to be able to break our applications into reusable components. That makes development and maintenance much more manageable. Sometimes, however, it can have an impact on performance. The more <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1232">ASP.NET 4.5 Hosting :: Streamlined Web Loading in the Visual Studio 2011</a></span>]]></description>
			<content:encoded><![CDATA[<p>One of the features of Visual Studio 11 that I’m really looking forward to taking advantage of is CSS and JavaScript minification and bundling.</p>
<p>As developers, we like to be able to break our applications into reusable components. That makes development and maintenance much more manageable. Sometimes, however, it can have an impact on performance. The more CSS style sheets and JavaScript files you add to a page, the longer that page will take to download – and it’s not just a matter of the size of the files; the number itself is a problem. Http requests are expensive; the more you have, the slower your page is to load, even if the absolute size of the downloaded files is not very large.</p>
<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p>Visual Studio 11 comes with two new features that make it more practical to break our JavaScript and CSS into multiple file. Bundling and minification give us a means of ‘componentizing’ our Web applications, without taking the performance hit of too many http requests. <em><strong>Bundling</strong></em> allows you to combine multiple files into a single larger file. <em><strong>Minification</strong></em> removes unnecessary white spaces to ensure that the new file is as small as possible. Taken together, the two techniques have a major impact on performance.</p>
<p>There are two versions of the functionality: the simple, automatic way; and the much more useful custom approach. In the simple version, the contents of folders are automatically bundled and minified if your &lt;link&gt; and &lt;script&gt; tags to point at the default directories and don’t specify individual files, thus:</p>
<p><code>&lt;link href=”/Content/css” rel=”stylesheet” type=”text/css” /&gt;</code></p>
<p>That gets converted into html along these lines at runtime:</p>
<p><code>&lt;link rel=”stylesheet” type=”text/css” href=“/Content/themes/base/css?v= UM624qf1uFt8dYtiIV9PCmYhsyeewBIwY4Ob0i8OdW81″ /&gt;</code></p>
<p>That’s fine as far as it goes, but is also rather limiting. You have to use default locations, and there’s no scope for having different bundles for different versions of your application.</p>
<p>The MVC4 template comes with a feature that’s designed to support this – <em>ResolveBundleUrl()</em>:</p>
<p><code>&lt;link href=”@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl (“~/Content/css”)“ rel=”stylesheet” type=”text/css” /&gt;</code></p>
<p>Now we can define our own custom bundles. In my case, I can create two new sub-folders under the style and script paths, one for mobiles and one for the standard Web site:<br />
<a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_1.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_1.jpg" alt="" title="image_1" width="315" height="157" class="aligncenter size-full wp-image-1233" /></a></p>
<p>Then I change the paths passed to ResolveBundleUrl() to point at my new folders….</p>
<p><code>&lt;link href=”@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl(“~/Content/site/css”)“ rel=”stylesheet” type=”text/css” /&gt;</p>
<p>&lt;script src=”@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl(“~/Scripts/site/js”)“&gt;&lt;/script&gt;</code></p>
<p><em>and… it doesn’t work.</em></p>
<p>Although ResolveBundleUrl() supports adding non-default paths, you have to do a little more work and register your new paths in the application start event in the Global.asax before it can use those paths<br />
<a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_2.jpg"><img src="http://www.aspnethostingnews.com/wp-content/uploads/2012/04/image_2.jpg" alt="" title="image_2" width="750" height="248" class="aligncenter size-full wp-image-1234" /></a></p>
<p>This tells the system that we’re adding two bundles – one for .css files and one for .js, and that all the files in the specified directories should be part of the bundle. (You can also specify individual files if you need to control the loading order beyond the default settings, which first prioritize known libraries like jQuery, then load the files alphabetically).</p>
<p>One nice additional feature is that the bundles are cached on the browser using the generated path (e.g. css?v=UM624qf1uFt8dYtiIV9PCmYhsyeewBIwY4Ob0i8OdW81). This means that not only are they loaded faster the first time the user visits the site, they do not need to be downloaded again the next time. More significantly, if any of the files in the bundled folder changes, so does the generated path. That means your users will never be stuck with old versions of your style sheets or JavaScript files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1232/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC Hosting :: Unauthenticated User Always Redirected to ~/Account/LogOn Despite Custom Sign In Url</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1229</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1229#comments</comments>
		<pubDate>Tue, 03 Apr 2012 06:40:30 +0000</pubDate>
		<dc:creator>Stephen Jackson</dc:creator>
				<category><![CDATA[ASP.NET MVC Hosting]]></category>
		<category><![CDATA[asp.net mvc 3 hosting]]></category>
		<category><![CDATA[cheap asp.net mvc 3 hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>
		<category><![CDATA[mvc 3 hosting]]></category>
		<category><![CDATA[mvc 3.0 hosting]]></category>
		<category><![CDATA[mvc hosting]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1229</guid>
		<description><![CDATA[
<p>By default new ASP.NET MVC projects redirect any unauthenticated users who request resources that require authentication to the /Account/LogOn action. The log on page is defined in the web.config authentication section.</p>
<p>&#60;authentication mode="Forms"&#62;
&#60;forms loginUrl="~/Account/LogOn" timeout="2880" /&#62;
&#60;/authentication&#62;</p>
<p>It is my preference for users to “Sign in” instead of “Log on” so I changed the web.config to the following and <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1229">ASP.NET MVC Hosting :: Unauthenticated User Always Redirected to ~/Account/LogOn Despite Custom Sign In Url</a></span>]]></description>
			<content:encoded><![CDATA[<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p>By default new ASP.NET MVC projects redirect any unauthenticated users who request resources that require authentication to the /Account/LogOn action. The log on page is defined in the web.config authentication section.</p>
<p><code>&lt;authentication mode="Forms"&gt;<br />
&lt;forms loginUrl="~/Account/LogOn" timeout="2880" /&gt;<br />
&lt;/authentication&gt;</code></p>
<p>It is my preference for users to “Sign in” instead of “Log on” so I changed the web.config to the following and changed the action method name from LogOn to SignIn.</p>
<p><code>&lt;authentication mode="Forms"&gt;<br />
&lt;forms loginUrl="~/Account/SignIn" timeout="2880" /&gt;<br />
&lt;/authentication&gt;</code></p>
<p>After the change I tried accessing a page that required the user to be authorized with and unauthorized user and to my surprise, the site redirected me to /Account/LogOn and I got a 404 error saying the the resource could not be found. It turns out this is a known issue with the ASP.NET MVC when the WebMatrix.Data.dll and WebMatrix.DataWeb.dll are added to the deployable assemblies collection. This issue can be fixed by adding the following key to the appSettings section of the web.config.</p>
<p><code>&lt;appSettings&gt;<br />
...<br />
&lt;add key="loginUrl" value="~/Account/SignIn" /&gt;<br />
&lt;/appSettings&gt;</code></p>
<p>I presume this will be fixed in the next release of ASP.NET MVC as a bug has been logged on Microsoft Connect <a href="https://connect.microsoft.com/webmatrix/feedback/details/665150/including-webmatrix-data-dll-webmatrix-webdata-dll-overrides-forms-loginurl">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1229/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET MVC 4 Hosting :: New Things to Learn in ASP.NET MVC 4</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1225</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1225#comments</comments>
		<pubDate>Wed, 28 Mar 2012 03:05:23 +0000</pubDate>
		<dc:creator>C Miller</dc:creator>
				<category><![CDATA[ASP.NET MVC 4 Hosting]]></category>
		<category><![CDATA[ASP.NET MVC Hosting]]></category>
		<category><![CDATA[.net mvc 4 hosting]]></category>
		<category><![CDATA[asp.net mvc 4 hosting .net mvc 4.0 hosting]]></category>
		<category><![CDATA[asp.net mvc 4.0 hosting]]></category>
		<category><![CDATA[ASPHostCentral]]></category>
		<category><![CDATA[ASPHostCentral.com]]></category>
		<category><![CDATA[mvc 4.0 hosting]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1225</guid>
		<description><![CDATA[<p>Introduction</p>
<p>MVC4 is really trying to break new ground in helping developers get to market more quickly and with a product that adheres to the emerging standards of today. A tough thing to ask of any technology, to be sure, but it&#8217;s making some decent strides in the right direction.</p>
<p>Already the tutorials and blogs posts are popping <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1225">.NET MVC 4 Hosting :: New Things to Learn in ASP.NET MVC 4</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>MVC4 is really trying to break new ground in helping developers get to market more quickly and with a product that adheres to the emerging standards of today. A tough thing to ask of any technology, to be sure, but it&#8217;s making some decent strides in the right direction.</p>
<p>Already the tutorials and blogs posts are popping up quicker than mushrooms on the midden heap. We highlight a few here that you definitely shouldn&#8217;t miss which deal with key upcoming features&#8230;</p>
<p><strong>ASP.NET MVC  4 Hosting</strong></p>
<p>If you are looking for a QUALITY, AFFORDABLE host that supports <a href="http://www.asphostcentral.com/ASPNET-MVC-4-Hosting.aspx">ASP.NET MVC 4 Hosting</a>, you can take a look at <strong><a href="http://www.asphostcentral.com/ASPNET-MVC-4-Hosting.aspx">ASPHostCentral.com</a></strong></p>
<p><a href="http://www.asphostcentral.com/ASPNET-MVC-4-Hosting.aspx"><img class="aligncenter size-full wp-image-1226" title="MVC 4 Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/adsone_mvc_4.gif" alt="" width="450" height="270" /></a><br />
<strong>ASP.NET MVC 4 Overview &#8211; Part 2</strong></p>
<p>Jon Galloway goes into some significant detail here about some of the changes coming our way in the new version. He talks about the new default templates that come out of the box and the reasoning behind them.</p>
<p>He also talks about the new adaptive rendering taking advantage of CSS media queries and the usage of the viewport meta tag to help improve the mobile user experience. Overall a solid post that will stand the test of time. Check it out&#8230;</p>
<p><strong>ASP.NET MVC 4 Bundling and Minification</strong></p>
<p>Bundling and Minification of assets have to be two of the most tedious things to setup on a new web project. In this excellent post, David Hayden goes through exactly what you need to do to make the process as seamless as possible in MVC4.</p>
<p>Don&#8217;t make the mistake of leaving this to the end of the project. You&#8217;ll have deployment nightmares you didn&#8217;t dream of and you&#8217;ll be kicking yourself for not smoothing out the wrinkles. Do it early, and you&#8217;ll thank yourself everyday for that small mercy&#8230;</p>
<p><strong>Micro ORM Data Mapping with PetaPoco and ASP.NET MVC 4</strong></p>
<p>Getting tired of working with the verbosity of Entity Framework classes and mapping? Well, you&#8217;re not the only one, and in this quality post, Greg Arroyo takes us for a lap around the track using PetaPoco as your Micro ORM in MVC4.</p>
<p>Micro ORMs really are here to stay, and in some ways, more broadly applicable to web applications of today where everyone is trying to keep things more simple. If you haven&#8217;t tried one yet, take this opportunity to get clued up on these fantastic tools.</p>
<p><strong>ASP.NET MVC 4 Web API Routes and ApiController</strong></p>
<p>Once again David Hayden masterfully takes us through a key piece of architecture that is going to be very important to anyone who will be working with MVC4. He details what seems to be a very slick piece of integration work between the new Web API framework and MVC4, and he throws in some OData queries for good measure.</p>
<p>It&#8217;s short and sweet, and just enough to get you going, and whet your appetite for how to architect your solutions around your own APIs, allowing for more decoupled designs with less possible points of failure.</p>
<p><strong>Getting started on your first Single Page Application</strong></p>
<p>As with the introduction of any new method now encompassed in a technology, it&#8217;s best to start with what comes straight from the horse&#8217;s mouth. This Walkthrough put together by Brad Severtson gives you a great introduction, and leaves the mind boggling as to the possibilities.</p>
<p>If you&#8217;ve ever wanted to build your own Gmail and specifically wanted to do it with MVC, then go ahead, knock yourself out! (no pun intended)..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1225/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET Hosting :: What is the Difference Between ASP.NET and ASP</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1222</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1222#comments</comments>
		<pubDate>Tue, 27 Mar 2012 01:54:53 +0000</pubDate>
		<dc:creator>Wayne Plotche</dc:creator>
				<category><![CDATA[ASP.NET Hosting]]></category>
		<category><![CDATA[.net 4 hosting]]></category>
		<category><![CDATA[.net 4.0 hosting]]></category>
		<category><![CDATA[.net hosting]]></category>
		<category><![CDATA[ASP.NET 2 Hosting]]></category>
		<category><![CDATA[asp.net 3.5 hosting]]></category>
		<category><![CDATA[asp.net 4]]></category>
		<category><![CDATA[asp.net 4.0 hosting]]></category>
		<category><![CDATA[cheap .net 4 hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1222</guid>
		<description><![CDATA[<p>Introduction</p>
<p>These are the list of differences which I came across while working on ASPand ASP.NET projects.</p>
<p>Background</p>
<p>I have seen many articles on Internet where in I came across the differences of ASP.NET and ASP. These articles are jumbled across the websites. I have compiled all those and published this article to give better understanding on the differences <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1222">ASP.NET Hosting :: What is the Difference Between ASP.NET and ASP</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>These are the list of differences which I came across while working on ASPand ASP.NET projects.</p>
<p><strong>Background</strong></p>
<p>I have seen many articles on Internet where in I came across the differences of ASP.NET and ASP. These articles are jumbled across the websites. I have compiled all those and published this article to give better understanding on the differences of both.</p>
<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p><strong>Description </strong></p>
<p>Process Isolation</p>
<p>ASP is run under the inetinfo.exe(IIS) process space and hence susceptible to application crashes as a result the IIS needs to be stopped or restarted. ASP is related to the process isolation setting in IIS.</p>
<p>But, ASP.Net</p>
<p>The ASP.NET worker process is a distinct worker process, aspnet_wp.exe, separate from inetinfo.exe ( IIS process), and the process model in ASP.NET is unrelated to process isolation settings in IIS.</p>
<p>Note :- IIS is still the entry point to a ASP.NET application</p>
<p>Non-MS Platform Support</p>
<p>Classical ASP had no mechanism of running itself on non- Microsoft technology platforms like the &#8216;The Apache Web Server&#8217;</p>
<p>But, ASP.NET</p>
<p>ASP.NET could be run on non-Microsoft Platforms also. <strong>Cassini</strong> is a sample Web server produced by Microsoft which, among other projects, has been used to host ASP.NET with <strong>Apache</strong>.</p>
<p>Multi Language Support in WebPage</p>
<p>In ASP only two languages were available for scripting VBScript and Jscript/Javascript.</p>
<p>But in ASP.NET</p>
<p>We are no longer constrained to the two scripting languages available in traditional ASP: Any fully compliant .NET language can now be used with ASP.NET, including C# and VB.NET.</p>
<p>Note :- (C# and VB.Net are both server Side languages.)</p>
<p>Interpretation Vs Compilation</p>
<p>In ASP, ASP engine executes server-side code, which is always through an interpreter (JScript or VBScript). When a traditional ASP page is requested, the text of that page is parsed linearly. All content that is not server-side script is rendered as is back to the response. All server-side script in the page is first run through the appropriate interpreter (JScript or VBScript), the output of which is then rendered back to the response. This architecture affects the efficiency of page rendering in several ways. First, interpreting the server-side script on the fly.As a side effect, one common optimization for ASP applications is to<br />
move a lot of server-side script into precompiled COM components to improve response times. A second efficiency concern is that intermingling server-side evaluation blocks with static HTML is less efficient than evaluating a single server-side script block, because the interpreter has to be invoked over and over again. Thus, to improve efficiency of rendering, many ASP developers resort to large blocks of server-side script, replacing static HTML elements with Response.Write() invocations instead. Finally, this ASP model actually allows different blocks of script within a page to be written in different script languages. While this may be appealing in some ways, it also degrades performance by requiring that a particular page load both scripting engines to<br />
process a request, which takes more time and memory than using just one language.</p>
<p>But in ASP.NET,</p>
<p>In contrast, ASP.NET pages are always compiled into .NET classes housed within assemblies. This class includes all of the server-side code and the static HTML, so once a page is accessed for the first time (or any page within a particular directory is accessed), subsequent rendering of that page is serviced by executing compiled code. This eliminates all the inefficiencies of the scripting model of traditional ASP. There is no longer any performance difference between compiled components and server-side code embedded within a page they are now both compiled components. There is also no performance difference between interspersing server-side code blocks among static HTML elements, and writing large blocks of server-side code and using<br />
Response.Write() for static HTML content. Also, because the .aspx file is parsed into a single code file and compiled, it is not possible to use multiple server-side languages within a single .aspx file.</p>
<p>Debugging benefits</p>
<p>In classic ASP it was very difficult for us to debug the application. ASP developers had time to debug application due to limited support due to the interpreted model.</p>
<p>But in ASP.NET In addition to improved performance over the interpreted model, pages that are compiled into classes can be debugged using the same debugging tools available to desktop applications or component developers. Errors with pages are generated as compiler errors, and there is a good chance that most errors will be found at compilation time instead of runtime, because VB.NET and C# are both strongly typed languages. Plus, all the tools available to the .NET developer are applicable to the .aspx developer.</p>
<p>Server-Side code placement Web Page</p>
<p>class=docText&gt;Especially if you are using ASP pages it is possible to include executable code outside the scope of a function within a script block marked as runat=server, and , it is possible to define a function within a pair of server-side script tags.</p>
<p>But in ASP.NET,</p>
<p>In ASP.NET it is no longer possible to include executable code outside the scope of a function within a script block marked as <strong>runat=server</strong>, and conversely, it is no longer possible to define a function within a pair of server-side script tags.</p>
<p>Note also that the generated class definition provides a default constructor for you, and if you try to define your own default constructor within your page, it will cause a compiler error. This can be somewhat frustrating if you are trying to properly initialize elements of your class (such as filling up our array of values or subscribing to events).<br />
Fortunately, an alternative technique gives you more complete control over the class definition while separating the layout from the page logic. This technique is called code-behind.</p>
<p>Deployment Strategies</p>
<p>In traditional ASP applications, components used by pages and deployed in this fashion were notoriously difficult to update or replace. Whenever the application was up and running, it held a reference to the component file so to replace that file, you had to shut down IIS (temporarily taking your Web server offline), replace the file, and restart IIS.</p>
<p>But in ASP.NET,</p>
<p>The goals of ASP.NET was to eliminate the need to stop the running Web application whenever components of that application need to be updated or replaced that is, updating an application should be as simple as using xcopy to replace the components on the Web server with the new updated versions. To achieve this xcopy deployment capability, the designers of ASP.NET had to ensure two things: first, that the running application not hold a reference to the component file and second, that whenever the component file was replaced with a new version, that new version was picked up with any subsequent requests made to the application. Both of these goals are achieved by using the shadow copy mechanism provided by the Common Language Runtime (CLR).</p>
<p>Shadow copying of assemblies is something you can configure when you create a new application domain in .NET. The AppDomainSetup class (used to initialize an AppDomain) exposes a Boolean property called ShadowCopyFiles and a string property called CachePath, and the AppDomain class exposes a method called SetShadowCopyPath() to enable shadow copying for a particular application domain. The Boolean property turns the mechanism on for a particular application domain, the CachePath specifies the base directory where the shadowed copies should be placed, and the SetShadowCopyPath() method specifies which directories should have shadow copying enabled.</p>
<p>ASP.NET creates a distinct application domain for each application it hosts in its worker process and for each application domain, it enables shadow copying of all assemblies referenced in the /bin directory. Instead of loading assemblies directly from the /bin directory, the assembly loader physically copies the referenced assembly to a separate directory (also indicated in the configuration settings for that application domain) and loads it from there. This mechanism also keeps track of where the assembly came from, so if a new version of that assembly is ever placed in the original /bin directory, it will be recopied into the Noteshadow&#8221; directory and newly referenced from there.</p>
<p>In addition to shadow copying of assemblies, ASP.NET needs the ability to create and load assemblies on the fly. The first time an .aspx page is referenced, as we have seen, it is compiled into an assembly and loaded by ASP.NET. What we haven&#8217;t seen is where those assemblies are located once they are compiled. Application domains also support the concept of a &#8220;dynamic directory&#8221; specified through the DynamicBase property of the AppDomainSetup class, which is a directory designed for dynamically generated assemblies that can then be referenced by the assembly loader. ASP.NET sets the dynamic directory of each application it houses to a subdirectory under the system Temporary ASP.NET Files directory with the name of the virtual directory of that application.</p>
<p>One consequence of both dynamic assembly generation and shadow copying is that many assemblies are copied during the lifetime of an ASP.NET application. The assemblies that are no longer being referenced should be cleaned up so that disk space usage doesn&#8217;t become a limiting factor in application growth. In ASP.NET shadow copied assemblies are removed as soon as possible after a new version of that assembly is copied, and dynamically generated assemblies that are no longer used are cleaned up the next time the ASP.NET worker process is bounced and the particular application associated with the dynamic assemblies is run again. In general, this means that you shouldn&#8217;t have to worry about unused assemblies generated by ASP.NET wasting space on your machine for very long.</p>
<p>New Page Directives</p>
<p>In ASP you must place all directives on the first line of a page within the same delimiting block. For example:</p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>&lt;%LANGUAGE=&#8221;VBSCRIPT&#8221;   CODEPAGE=&#8221;932&#8243;%</td>
</tr>
</tbody>
</table>
<p>But in ASP.NET, you are now required to place the Language directive with a Page directive, as follows:</p>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td>&lt;%@Page   CodePage=&#8221;932&#8243;%&gt; &lt;%@QutputCache   Duration=&#8221;60&#8243; VaryByParam=&#8221;none&#8221;</td>
</tr>
</tbody>
</table>
<p>You can have as many lines of directives as you need. Directives may be located anywhere in your .apsx file but standard practice is to place them at the beginning of the file. Several new directives have been added in ASP.NET. I encourage you to look these up in the ASP.NET documentation to see how they may benefit your application.</p>
<p>Threading Issues</p>
<p>The threading model of COM object created using VB within a web-based application is STA. ASP worker thread resides in its own STA and hence the compatability is fine in this case with a little performance hit.</p>
<p>But in ASP.NET,</p>
<p>The ASP.NET threading model is the Multiple Threaded Apartment (MTA). What this means is that components that you are using that were created for the Single Threaded Apartment (STA) will no longer perform or function reliably without taking some extra precautions in ASP.NET. This includes, but is not limited to, all COM components that have been created using Visual Basic 6.0 and earlier versions. You will be glad to hear that you can still use these STA components without having to change any code. What you need to do is include the compatibility attribute aspcompat=true in a &lt;%@Page&gt; tag on the ASP.NET page. For example, &lt;%@Page aspcompat=true Language=VB%&gt;. Using this attribute will force your page to execute in STA mode, thus ensuring your component will continue to function correctly. If you attempt to use an STA component without specifying this tag, the run time will throw an exception. Setting this attribute to true will also allow your page to call COM+ 1.0 components that require access to the unmanaged ASP built-in objects. These are accessible via the ObjectContext object. If you set this tag to true, your performance will degrade slightly. I suggest doing this only if you absolutely need to.</p>
<p>Validation &amp; Browser scripting capabilities</p>
<ul>
<li>ASP      has no inbuilt facility for Validation of controls.i.e, checking whether a      textbox is left blank or not or a combo is selected or not or if a phone      number does not fit a particular pattern for a area and many such      examples.</li>
</ul>
<ul>
<li>The      user had to write the client side Javascript code for all these kind of      validations.</li>
</ul>
<ul>
<li>Client      and server side validation both were the headache of the of the developer.</li>
</ul>
<ul>
<li>Javascript      code to fit a particular Browser was also the developer&#8217;s burden. He had      to write specific code so that it could fit a set of browsers. It took lot      of the developers time.</li>
</ul>
<p>But in ASP.NET,</p>
<p>In built validation controls are provided which are as easy to implement and the developer has to worry the least.</p>
<p>The features provided by ASP.NET validation controls is :-</p>
<ul>
<li>Browser      Independent coding :- Developer does not have to worry about the browser      how the controls would render to.</li>
</ul>
<ul>
<li>Client-Side      or Server-Side :- The Validation Controls manage the code checking if the      client side code is disabled the validation is done on the server side.</li>
</ul>
<p><strong>Rich Validation set :-</strong> There are 6 types of validation which cater to the needs of the validation requirements:</p>
<ul>
<li>RequiredFieldValidation      Control &#8211; Requires that the control not be left blank.</li>
</ul>
<ul>
<li>CompareValidator      Control &#8211; Used to compare Data in Two Controls</li>
</ul>
<ul>
<li>RangeValidator      Control &#8211; Used to check for Range validation.(also supports various data      Type &#8211; Date , string etc..)</li>
</ul>
<ul>
<li>RegularExpressionValidator      Control &#8211; Used to check the complicated patterns in the user input.</li>
</ul>
<ul>
<li>CustomValidator      Control- The final control we have included in ASP.NET is one that adds      great flexibility to our validation abilities. We have a custom validator      where we get to write out own functions and pass the control value to this      function.</li>
</ul>
<p>This control also provides Client side and server side validation of which the Server side validation could be a different function altogether.</p>
<ul>
<li>Validation      Summary &#8211; The validation summary control will collect all the error      messages of all the non-valid controls and put them in a tidy list. The      list can be either shown on the web page (as shown in the example above)      or with a popup box</li>
</ul>
<p><strong>Conclusion</strong></p>
<p>This article targets to the developers who have directly started working on ASP.Net and also for the web developers who have migrated from ASP to ASP.Net. This article is at the draft level and might need additions which I intend to do.I welcome suggestion or criticism!! I would request to add as much feedback to this article post as possible. I would keep this post updated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1222/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 3 Hosting :: Difference Between ViewBag and ViewData in MVC 3</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1220</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1220#comments</comments>
		<pubDate>Mon, 26 Mar 2012 03:38:12 +0000</pubDate>
		<dc:creator>Wayne Plotche</dc:creator>
				<category><![CDATA[ASP.NET MVC 3 Hosting]]></category>
		<category><![CDATA[asp.net mvc 3 hosting]]></category>
		<category><![CDATA[asp.net mvc 3.0 hosting]]></category>
		<category><![CDATA[ASP.NET MVC Hosting]]></category>
		<category><![CDATA[cheap asp.net mvc 3 hosting]]></category>
		<category><![CDATA[cheap asp.net mvc hosting]]></category>
		<category><![CDATA[hostforlife]]></category>
		<category><![CDATA[hostforlife.eu]]></category>
		<category><![CDATA[mvc 3.0 hosting]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1220</guid>
		<description><![CDATA[<p>If you’re new to ASP.NET MVC, you might be wondering what these two things are and when to use each one. If you’ve been using MVC and are just new to version 3 of MVC, you are probably wondering what this new ViewBag is for and if it’s different from the ViewData you’ve been using. In <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1220">ASP.NET MVC 3 Hosting :: Difference Between ViewBag and ViewData in MVC 3</a></span>]]></description>
			<content:encoded><![CDATA[<p>If you’re new to ASP.NET MVC, you might be wondering what these two things are and when to use each one. If you’ve been using MVC and are just new to version 3 of MVC, you are probably wondering what this new ViewBag is for and if it’s different from the ViewData you’ve been using. In the beginning of the Summer, I had the opportunity to explain this difference to the two NimblePros interns when they started working on ASP.NET MVC 3 for the first time. This post should serve as a reference for them, me, and anyone else who is interested in knowing more about these two objects.</p>
<p>ViewBag and ViewData serve the same purpose in allowing developers to pass data from controllers to views. When you put objects in either one, those objects become accessible in the view. This is one way we interact between the view and the controller in ASP.NET MVC. We pass data from the view to the controller by placing it in these objects.</p>
<h3>How ViewData Works</h3>
<p>ViewData is a dictionary of objects that are accessible using strings as keys. This means that we will write code like this:</p>
<div><a href="http://www.hostforlife.eu"><img class="aligncenter size-full wp-image-1065" title="European Windows Hosting" src="http://www.aspnethostingnews.com/wp-content/uploads/2011/12/ads_300x180.jpg" alt="" width="400" height="230" /></a></div>
<p><strong>In the Controller</strong></p>
<p><code>public ActionResult Index()<br />
{<br />
var softwareDevelopers = new List&lt;string&gt;<br />
{<br />
"Brendan Enrick",<br />
"Kevin Kuebler",<br />
"Todd Ropog"<br />
};</p>
<p>ViewData["softwareDevelopers"] = softwareDevelopers;</p>
<p>return View();<br />
}</code></p>
<p><strong>In the View</strong></p>
<p><code>&lt;ul&gt;<br />
@foreach (var developer in (List&lt;string&gt;)ViewData["softwareDevelopers"])<br />
{<br />
&lt;li&gt;<br />
@developer<br />
&lt;/li&gt;<br />
}<br />
&lt;/ul&gt;</code></p>
<p>Notice that when we go to use out object on the view that we have to cast it since the ViewData is storing everything as object. Also, we need to be careful since we’re using magic strings to access these values.</p>
<h3>How ViewBag Works</h3>
<p>ViewBag uses the dynamic feature that was added in to C# 4. It allows an object to dynamically have properties added to it. The code we write using ViewBag will look like this:</p>
<p><strong>In the Controller</strong></p>
<p><code>public ActionResult Index()<br />
{<br />
var softwareDevelopers = new List&lt;string&gt;<br />
{<br />
"Brendan Enrick",<br />
"Kevin Kuebler",<br />
"Todd Ropog"<br />
};</p>
<p>ViewBag.softwareDevelopers = softwareDevelopers;</p>
<p>return View();<br />
}</code></p>
<p><strong>In the View</strong></p>
<p><code>&lt;ul&gt;<br />
@foreach (var developer in ViewBag.softwareDevelopers)<br />
{<br />
&lt;li&gt;<br />
@developer<br />
&lt;/li&gt;<br />
}<br />
&lt;/ul&gt;</code></p>
<p>Notice here that we did not have to cast our object when using the ViewBag. This is because the dynamic we used lets us know the type. <em>Keep in mind that these dynamics are as the name suggest, dynamic, which means that you need to be careful as these are basically magic properties instead of magic strings</em>.</p>
<h3>ViewBag and ViewData Under the Hood</h3>
<p>So these two things seem to work almost exactly the same. What’s the difference? The difference is only in how you access the data. ViewBag is actually just a wrapper around the ViewData object, and its whole purpose is to let you use dynamics to access the data instead of using magic strings. Some people prefer one style over the other. You can pick whichever you like. In fact, because they’re the same data just with two different ways of accessing it, you can use them interchangeably. (I don’t recommend this, but you can do it.) If you want you are able to put data into the ViewBag and access it from the ViewData or put stuff in the ViewData and access it in the ViewBag.</p>
<p>This is all that the ViewBag property is. It’s just a DynamicViewDataDictionary with the ViewData as its data.</p>
<p><code>public dynamic ViewBag<br />
{<br />
get<br />
{<br />
if (_dynamicViewData == null)<br />
{<br />
_dynamicViewData =<br />
new DynamicViewDataDictionary(() =&gt; ViewData);<br />
}<br />
return _dynamicViewData;<br />
}<br />
}</code></p>
<p>Then when we access the dynamic members of the DynamicViewDataDictionary, we are actually just getting this override of the DynamicObject’s TryGetMember. In this method, it’s just using the name of the member we tried to access as the string key for the ViewData dictionary.</p>
<p><code>public override bool TryGetMember(<br />
GetMemberBinder binder, out object result)<br />
{<br />
result = ViewData[binder.Name];<br />
return true;<br />
}</code></p>
<p>So for a short answer:</p>
<p><em>These two objects are two different ways of accessing the exact same data. The ViewBag is just a dynamic wrapper around the ViewData dictionary.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1220/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 4 Hosting :: Entity Frameworks Database Migration and ASP.NET MVC 4</title>
		<link>http://www.aspnethostingnews.com/index.php/archives/1212</link>
		<comments>http://www.aspnethostingnews.com/index.php/archives/1212#comments</comments>
		<pubDate>Thu, 22 Mar 2012 03:36:00 +0000</pubDate>
		<dc:creator>C Miller</dc:creator>
				<category><![CDATA[ASP.NET MVC 4 Hosting]]></category>
		<category><![CDATA[.net mvc 4 hosting]]></category>
		<category><![CDATA[asp.net mvc 4 hosting .net mvc 4.0 hosting]]></category>
		<category><![CDATA[asp.net mvc 4.0 hosting]]></category>
		<category><![CDATA[ASPHostCentral]]></category>
		<category><![CDATA[ASPHostCentral.com]]></category>
		<category><![CDATA[mvc 4.0 hosting]]></category>

		<guid isPermaLink="false">http://www.aspnethostingnews.com/?p=1212</guid>
		<description><![CDATA[<p>ASP.NET MVC 4 was released in beta by the Microsoft ASP.NET MVC Developer Team and it comes with a number of really cool features: Bundling and Minification Support of CSS and JavaScript, Database Migrations using Entity Framework 4.3, Web APIs, Mobile Web with support for jQuery Mobile, Real Time Communication via SignalR, and Asynchronous Support. The <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.aspnethostingnews.com/index.php/archives/1212">ASP.NET MVC 4 Hosting :: Entity Frameworks Database Migration and ASP.NET MVC 4</a></span>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/mvc4_a.gif"></a>ASP.NET MVC 4 was released in beta by the Microsoft ASP.NET MVC Developer Team and it comes with a number of really cool features: Bundling and Minification Support of CSS and JavaScript, Database Migrations using Entity Framework 4.3, Web APIs, Mobile Web with support for jQuery Mobile, Real Time Communication via SignalR, and Asynchronous Support. The Database Migrations using Entity Framework Code-First is really cool and is very much like Rails where you can change your code and then via Package Manager add migrations and update your database as your code evolves. Because the EF Migration Files and Configuration get added to your Visual Studio Solution, all the database migration changes get added to source code.</p>
<p><strong>If you are looking for a quality <a href="http://www.asphostcentral.com/ASPNET-MVC-4-Hosting.aspx">ASP.NET MVC 4 Hosting</a> provider, please have a look at <a href="http://www.asphostcentral.com/ASPNET-MVC-4-Hosting.aspx">ASPHostCentral.com</a></p>
<p><a href="http://www.asphostcentral.com/ASPNET-MVC-4-Beta-Hosting.aspx"><img class="aligncenter size-full wp-image-1218" title="adsone_aspnet_mvc4_beta" src="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/adsone_aspnet_mvc4_beta1.gif" alt="" width="450" height="270" /></a></strong></p>
<p><strong>ASP.NET MVC 4 and Entity Framework Code-First</strong></p>
<p>ASP.NET MVC support for EF Code-First has been there since ASP.NET MVC 3. To jump start playing with Database Migrations start an empty ASP.NET MVC 4 Project and use Package Manager to install or update Entity Framework to the latest version that includes Database Migrations.</p>
<p>Install-Package EntityFramework</p>
<p>Add a simple Product Class that represents a product in your E-Commerce Website. Let&#8217;s intially make Product simple by just providing an Id and Title to it.</p>
<p>public class Product {<br />
    public int Id { get; set; }<br />
    publis string Title { get; set; }<br />
}</p>
<p>Run the Add Controller Recipe in ASP.NET MVC 4 to add a Products Controller that uses Entity Framework to read/write to the Database of your E-Commerce Website.</p>
<p><img title="mvc4_a" src="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/mvc4_a.gif" alt="" width="503" height="335" /></p>
<p>Once the Add Controller Recipe is finished you will have a working ASP.NET MVC 4 Website that reads and writes products to the Database using Entity Framework. The ProductsController was created along with all actions and views that display, create, update, and delete products.</p>
<p><strong>Enabled Database Migrations to ASP.NET MVC 4</strong></p>
<p>Now we want to enable database migrations to ASP.NET MVC 4 by using the Package Manager Console.</p>
<p>Enable-Migrations</p>
<p>Enabling database migrations creates a new Migrations Folder in your Visual Studio Solution as well as an InitialCreate Target Migration that has both an Up and Down Migration. The Up Migration creates the Products Table while the Down Migration drops the Products Table.</p>
<p>public partial class InitialCreate : DbMigration {<br />
    public override void Up() {<br />
        CreateTable(<br />
            &#8220;Products&#8221;,<br />
                 c =&gt; new<br />
                 {<br />
                      Id = c.Int(nullable: false, identity: true),<br />
                      Title = c.String(),<br />
                  })<br />
                  .PrimaryKey(t =&gt; t.Id);<br />
         );<br />
     }</p>
<p>     public override void Down() {<br />
          DropTable(&#8220;Products&#8221;);<br />
     }<br />
 }</p>
<p><strong>Add New Database Migration to ASP.NET MVC 4 Website</strong></p>
<p>Now let&#8217;s say we want to add more properties to the Product Class as well as make Title a Required Property and a length of 255 characters.</p>
<p>public class Product {<br />
    public int Id { get; set; }</p>
<p>    [Required,MaxLength(255)]<br />
    public string Title { get; set; }</p>
<p>    public string Description { get; set; }</p>
<p>    public decimal Price { get; set; }<br />
}</p>
<p>One can now add a data migration as well as update the database via the Package Manager Console.</p>
<p>Add-Migration AddDescriptionPriceToProduct<br />
Update-Database</p>
<p>The Add-Migration command creates another file in the Migrations Folder of our ASP.NET MVC 4 Project and the Update-Database command updates the database with the new Description and Price Columns as well as modifies the Title Column to be only 255 characters and not nullable.</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/mvc4_b.gif"><img class="aligncenter size-full wp-image-1216" title="mvc4_b" src="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/mvc4_b.gif" alt="" width="374" height="104" /></a></p>
<p>If you look at the ASP.NET MVC 4 Database before and after issuing this Database Migration you will notice the effect.</p>
<p><a href="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/mvc4_c.gif"><img class="aligncenter size-full wp-image-1217" title="mvc4_c" src="http://www.aspnethostingnews.com/wp-content/uploads/2012/03/mvc4_c.gif" alt="" width="505" height="324" /></a></p>
<p>And, of course, the new Database Migration File has the approprite Up and Down Methods.</p>
<p>public partial class AddDescriptionPriceToProduct : DbMigration {<br />
    public override void Up() {<br />
        AddColumn(&#8220;Products&#8221;, &#8220;Description&#8221;, c =&gt; c.String());<br />
        AddColumn(&#8220;Products&#8221;, &#8220;Price&#8221;,<br />
            c =&gt; c.Decimal(nullable: false, precision: 18, scale: 2));<br />
        AlterColumn(&#8220;Products&#8221;, &#8220;Title&#8221;,<br />
            c =&gt; c.String(nullable: false, maxLength: 255));<br />
    }</p>
<p>    public override void Down() {<br />
        AlterColumn(&#8220;Products&#8221;, &#8220;Title&#8221;, c =&gt; c.String());<br />
        DropColumn(&#8220;Products&#8221;, &#8220;Price&#8221;);<br />
        DropColumn(&#8220;Products&#8221;, &#8220;Description&#8221;);<br />
    }<br />
}</p>
<p><strong>Conclusions</strong></p>
<p>If you are a Rails Developer moving to ASP.NET MVC 4, you will find the Database Migrations support in Entity Framework a nice addition to the tooling. And, of course, those ASP.NET MVC 4 Developers that love Code-First Development with Entity Framework will love the new Database Migrations support in EF 4.3. Don&#8217;t forget to check out other ASP.NET MVC 4 Features such as bundling and minification of CSS and JavaScript, Web API&#8217;s, Asynchronous Support, and the mobile web templates. ASP.NET MVC 4 is still in beta at this point, but it has a go-live license.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aspnethostingnews.com/index.php/archives/1212/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

