<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Shaan's Official Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/shaan/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/shaan/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:27:17 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Handle Error Gracefully</title>
      <link>https://docs.microsoft.com/archive/blogs/shaan/handle-error-gracefully</link>
      <pubDate>Wed, 30 Dec 2009 18:14:15 GMT</pubDate>
      <dc:creator><![CDATA[Shaans]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/shaan/2009/12/30/handle-error-gracefully/</guid>
      <description><![CDATA[Writing error free application is difficult.   Error occurs at runtime due to unexpected user input,...]]></description>
      <content:encoded><![CDATA[<p>Writing error free application is difficult. </p>  <p>Error occurs at runtime due to unexpected user input, environment dependencies and other reasons. You must take care of all known conditions that leads the application to crash. Crashes cause user frustration and decreases your reputation. </p>  <p>Even though you test your applications with all the effort you can give, still you can’t guarantee the software is 100% bug free. I bet, no one can!</p>  <p>When you deploy Windows GUI Applications on the end users machine, you lose control. Imagine a situation when your costumer reporting you of application crash and you wish you could capture all possible reasons of the crash. Even though you can get all user inputs and corresponding actions, that might not be enough. </p>  <p>Fortunately windows provides a set up utilities that can gather all environmental preconditions by capturing application data for that moment in a file. That is called dump (or memory dump). </p>  <p>The dump is a snapshot of the application (or systems memory) that can be used later for further analysis with debugging tools like windbg or Visual Studio. While you are in the development mode you start the process inside the visual studio (F5). </p>  <p>Visual Studio does various steps internally to connect to the process &amp; maps executing system instructions with your source code with help of PDB files. If you set break point, the windows waits for signal from the debugger the proceed and shows you current state of different variables. If you are advanced developer you can make use of Local windows or Watch expressions to see and manipulate the values. This is easy since the processes memory is accessible to the debugger. But when you want to check the variables state at the time user reported an error from his/her machine is not that easy. The dump files comes rescue.</p>  <p>Generating dump of processes running under Windows Vista and newer operating system is simple. </p>  <p>As right clicking on the process in <strong>Windows Task Manager</strong> and <strong>Create Dump File</strong></p>  <p><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="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/shaan/WindowsLiveWriter/HandleErrorGracefully_FA8D/image_3.png" original-url="https://blogs.msdn.com/blogfiles/shaan/WindowsLiveWriter/HandleErrorGracefully_FA8D/image_3.png" width="572" height="388" /></p>  <p>You can also use Windows API to generate Dumps when application crashes. Because after the crash the process may not be available any longer in the task manager.</p>  <pre><code>BOOL WINAPI MiniDumpWriteDump(
  __in  HANDLE <em>hProcess</em>,
  __in  DWORD <em>ProcessId</em>,
  __in  HANDLE <em>hFile</em>,
  __in  MINIDUMP_TYPE <em>DumpType</em>,
  __in  PMINIDUMP_EXCEPTION_INFORMATION <em>ExceptionParam</em>,
  __in  PMINIDUMP_USER_STREAM_INFORMATION <em>UserStreamParam</em>,
  __in  PMINIDUMP_CALLBACK_INFORMATION <em>CallbackParam</em>
);</code></pre>

<p>Equivalent C# API to call this native procedure is the following</p>

<pre class="code">[<span style="color: #2b91af">DllImport</span>(<span style="color: #a31515">&quot;DbgHelp.dll&quot;</span>, SetLastError = <span style="color: blue">true</span>)]
<span style="color: blue">private static extern bool </span>MiniDumpWriteDump(<span style="color: #2b91af">IntPtr </span>hProcess, <span style="color: blue">int </span>processId, <span style="color: #2b91af">SafeHandle </span>fileHandle, <span style="color: blue">int </span>dumpType, <span style="color: #2b91af">IntPtr </span>excepInfo, <span style="color: #2b91af">IntPtr </span>userInfo, <span style="color: #2b91af">IntPtr </span>extInfo);</pre>
<a href="https://11011.net/software/vspaste"></a>

<p>Windows Applications provides global error handler event, that can be used to capture any unhandled exceptions from all threads.</p>

<p>You can subscribe to the event by wiring a global procedure in Program class. You should do this before running any other function.</p>

<p><span style="color: #2b91af">Application</span>.ThreadException += <span style="color: blue">new</span>System.Threading.<span style="color: #2b91af">ThreadExceptionEventHandler</span>(Application_ThreadException);</p>

<p>You may invoke MiniDumpWriteDump procedure inside Application_ThreadException function as soon as any error occurs.</p>

<p>This helper function would write Dump file to the system temporary directory and the user may send the error report as an email attachment or upload to your website. Also note that the procedure generates full memory dump that can be used for debugging Managed Code. Full dump file size can be larger depending on the memory usage of the executing process.</p>

<pre class="code"><span style="color: blue">internal static string </span>WriteDump()
{
    <span style="color: blue">using </span>(<span style="color: #2b91af">Process </span>process = <span style="color: #2b91af">Process</span>.GetCurrentProcess())
    {
        <span style="color: blue">string </span>dumpFilePath = <span style="color: #2b91af">Path</span>.Combine(<span style="color: #2b91af">Path</span>.GetTempPath(), <span style="color: #2b91af">Application</span>.ProductName + <span style="color: #2b91af">DateTime</span>.Now.ToFileTimeUtc() + <span style="color: #a31515">&quot;.dmp&quot;</span>);
        <span style="color: blue">using </span>(<span style="color: #2b91af">FileStream </span>stream = <span style="color: blue">new </span><span style="color: #2b91af">FileStream</span>(dumpFilePath, <span style="color: #2b91af">FileMode</span>.Create, <span style="color: #2b91af">FileAccess</span>.ReadWrite))
        {
            <span style="color: #2b91af">Program</span>.MiniDumpWriteDump(process.Handle, process.Id, stream.SafeFileHandle, 0x306, <span style="color: #2b91af">IntPtr</span>.Zero, <span style="color: #2b91af">IntPtr</span>.Zero, <span style="color: #2b91af">IntPtr</span>.Zero);
        }
        <span style="color: blue">return </span>dumpFilePath;
    }
}</pre>

<p>Similarly in <strong>ASP.net Web Applications</strong> all unhandled exceptions can be logger from Global.asax in asp.net, similar to the following code snippet.</p>

<pre class="code"><span style="color: blue">void </span>Application_Error(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e) 
{ 
    <span style="color: #2b91af">Exception </span>ex = Server.GetLastError();
    ExceptionManager.Log(ex); <span style="color: green">//...... Log error here.
    </span>Server.Transfer(“DefaultError.aspx”);  
}</pre>

<p><strong>Also in WPF Applications</strong></p>

<pre class="code"><span style="color: blue">public partial class </span><span style="color: #2b91af">App </span>: Application
{
    <span style="color: blue">public </span>App()
    {
        <span style="color: blue">this</span>.DispatcherUnhandledException += <span style="color: blue">new </span>DispatcherUnhandledExceptionEventHandler( App_DispatcherUnhandledException);
    }
}</pre>

<p>You can find a sample code attached here for Handling crash and generating dump file.</p>
<iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="https://cid-bcb40a38bff76b14.skydrive.live.com/embedicon.aspx/.Public/CrashReport.zip" frameborder="0" marginwidth="0" scrolling="no"></iframe>]]></content:encoded>
    </item>
    <item>
      <title>Fixing jQuery intellisense error for Visual Studio 2008</title>
      <link>https://docs.microsoft.com/archive/blogs/shaan/fixing-jquery-intellisense-error-for-visual-studio-2008</link>
      <pubDate>Tue, 01 Dec 2009 12:10:17 GMT</pubDate>
      <dc:creator><![CDATA[Shaans]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/shaan/2009/12/01/fixing-jquery-intellisense-error-for-visual-studio-2008/</guid>
      <description><![CDATA[It happens to you if you are a developer or debugger running VS 2008 and trying to use JavaScript...]]></description>
      <content:encoded><![CDATA[<p>It happens to you if you are a developer or debugger running VS 2008 and trying to use JavaScript intellisence for your favorite JS library. This just does not happen<strong> *only*</strong> to jQuery but any Visual Studio JScript document (-<strong>vsdoc.js</strong>)</p>  <p>You wont get intellisence and you may get warning in VS Error List that look like following :</p>  <p>Warning&#160;&#160;&#160; 1&#160;&#160;&#160; Error updating JScript IntelliSense: C:\Users\someone\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\script\jquery-1.3.1.min.js: Object doesn't support this property or method @ 18:8308&#160;&#160;&#160; C:\Users\someone\Documents\Visual Studio 2008\Projects\WebApplication1\WebApplication1\Default.aspx&#160;&#160;&#160; 1&#160;&#160;&#160; 1&#160;&#160;&#160; WebApplication1</p>  <p>This is a bug in VS 2008 and you have a fix to this issue. You would require SP1 for Visual Studio 2008 before applying the hotfix.</p>  <p>Download from code.msdn.microsoft.com <a href="https://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736">here</a>.</p>  <p><a title="https://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736" href="https://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736">https://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736</a></p>  <p><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="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/shaan/WindowsLiveWriter/FixingjQueryintellisenseerror_AA48/image_3.png" original-url="https://blogs.msdn.com/blogfiles/shaan/WindowsLiveWriter/FixingjQueryintellisenseerror_AA48/image_3.png" width="513" height="75" /> </p>  <p>Once you are done, you are a happy programmer again <img style="display: inline; margin-left: 0px; margin-right: 0px" alt="smile_wink" align="left" src="https://spaces.live.com/rte/emoticons/smile_wink.gif" />!!</p>]]></content:encoded>
    </item>
    <item>
      <title>Invoke Method by Name</title>
      <link>https://docs.microsoft.com/archive/blogs/shaan/invoke-method-by-name</link>
      <pubDate>Mon, 16 Nov 2009 11:26:02 GMT</pubDate>
      <dc:creator><![CDATA[Shaans]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/shaan/2009/11/16/invoke-method-by-name/</guid>
      <description><![CDATA[Did you ever wonder how AutoEventWireup=&quot;true&quot; works in ASP.NET Pages? The page class...]]></description>
      <content:encoded><![CDATA[<p></p>  <p>Did you ever wonder how AutoEventWireup=&quot;true&quot; works in ASP.NET Pages? The page class basically hooks different generic event handler methods to the page life-cycle.   <br />Such as Page_Load Method get’s called if present. OK!! It’s called using reflection.</p>  <p><span style="color: blue">public partial class</span><span style="color: #2b91af">_Default</span>: System.Web.UI.<span style="color: #2b91af">Page     <br /></span>{    <br />&#160;&#160;&#160; <span style="color: blue">protected void</span>Page_Load(<span style="color: blue">object</span>sender, <span style="color: #2b91af">EventArgs </span>e)    <br />&#160;&#160;&#160; {</p>  <p>   <br />&#160;&#160;&#160; }    <br />}</p>  <p>&#160;</p> <a href="https://11011.net/software/vspaste"></a>  <p><span style="color: blue"></span></p>  <p>You can use a delegate or MethodInfo object to invoke method with a known signature. Here is a quick test that shows how do you do such in your code</p>  <p>Out test&#160; :</p>  <pre class="code"><span style="color: blue">using </span>System;

<span style="color: blue">namespace </span>ConsoleApplication1
{
    <span style="color: blue">class </span><span style="color: #2b91af">Program
    </span>{
        <span style="color: blue">delegate string </span><span style="color: #2b91af">TestMessageHandler</span>(<span style="color: blue">string </span>s);

        <span style="color: blue">static void </span>Main(<span style="color: blue">string</span>[] args)
        {
            <span style="color: #2b91af">Delegate </span>dl = <span style="color: #2b91af">Delegate</span>.CreateDelegate(
                <span style="color: blue">typeof</span>(<span style="color: #2b91af">TestMessageHandler</span>),
                <span style="color: blue">typeof</span>(<span style="color: #2b91af">Program</span>),
                <span style="color: #a31515">&quot;SayHi&quot;</span>);

            <span style="color: #2b91af">Console</span>.WriteLine(dl.DynamicInvoke(<span style="color: #a31515">&quot;Bill&quot;</span>));
            <span style="color: #2b91af">Console</span>.ReadLine();
        }
        
        <span style="color: blue">public static string </span>SayHi(<span style="color: blue">string </span>name)
        {
            <span style="color: blue">return </span><span style="color: #a31515">&quot;Welcome &quot; </span>+ name;
        }        
    }
}</pre>

<p>Even you can make this more strongly typed by casting the resulting Delegate object of <span style="color: #2b91af">Delegate</span>.CreateDelegate&#160; to the target delegate (<span style="color: #2b91af">TestMessageHandler</span>)</p>

<p>Have fun..</p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint Development get easy!</title>
      <link>https://docs.microsoft.com/archive/blogs/shaan/sharepoint-development-get-easy</link>
      <pubDate>Mon, 19 Oct 2009 14:26:12 GMT</pubDate>
      <dc:creator><![CDATA[Shaans]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/shaan/2009/10/19/sharepoint-development-get-easy/</guid>
      <description><![CDATA[One of the major feedback from the development community was about the complexity of setting up...]]></description>
      <content:encoded><![CDATA[<p>One of the major feedback from the development community was about the complexity of setting up development environment. </p>  <p>Microsoft Listened! </p>  <p>Now you would&#160; <strong>not</strong> need a Windows Server 2008 box to be able to develop applications for SharePoint with Visual Studio 2010. SharePoint Server Foundation (previously known as Windows SharePoint Services or WSS) on Windows 7 &amp; Vista. Sorry XP guys :)</p>  <p>One constraint though, it has to be a x64 OS and you need to go through series of pre defined steps to enable these.</p>  <p>&#160;</p>  <p><strong>Visual Studio 2010 &amp; SharePoint 2010 are good partner for sure. </strong></p>]]></content:encoded>
    </item>
    <item>
      <title>Dissecting ASP.NET MVC Framework</title>
      <link>https://docs.microsoft.com/archive/blogs/shaan/dissecting-asp-net-mvc-framework</link>
      <pubDate>Sat, 17 Oct 2009 03:06:34 GMT</pubDate>
      <dc:creator><![CDATA[Shaans]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/shaan/2009/10/17/dissecting-asp-net-mvc-framework/</guid>
      <description><![CDATA[Have you already started developing web apps on the new ASP.NET MVC framework? If yes, then...]]></description>
      <content:encoded><![CDATA[<meta content="text/html; charset=windows-1252" http-equiv="Content-Type" /><meta name="ProgId" content="Word.Document" /><meta name="Generator" content="Microsoft Word 14" /><meta name="Originator" content="Microsoft Word 14" /><link rel="File-List" href="Dissecting%20ASP_files/filelist.xml" /><link rel="themeData" href="Dissecting%20ASP_files/themedata.thmx" /><link rel="colorSchemeMapping" href="Dissecting%20ASP_files/colorschememapping.xml" /><style>

<!--
 /* Font Definitions */
 @font-face
	{font-family:cambria;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073741899 0 0 415 0;}
@font-face
	{font-family:calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-520092929 1073786111 9 0 415 0;}
 /* Style Definitions */
 p.msonormal, li.msonormal, div.msonormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
h1
	{mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-link:"Heading 1 Char";
	mso-style-next:normal;
	margin-top:24.0pt;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:0in;
	margin-bottom:.0001pt;
	line-height:115%;
	mso-pagination:widow-orphan lines-together;
	page-break-after:avoid;
	mso-outline-level:1;
	font-size:14.0pt;
	font-family:"Cambria","serif";
	mso-ascii-font-family:cambria;
	mso-ascii-theme-font:major-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:major-fareast;
	mso-hansi-font-family:cambria;
	mso-hansi-theme-font:major-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:major-bidi;
	color:#376092;
	mso-themecolor:accent1;
	mso-themeshade:191;
	mso-font-kerning:0pt;}
h2
	{mso-style-priority:9;
	mso-style-qformat:yes;
	mso-style-link:"Heading 2 Char";
	mso-style-next:normal;
	margin-top:10.0pt;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:0in;
	margin-bottom:.0001pt;
	line-height:115%;
	mso-pagination:widow-orphan lines-together;
	page-break-after:avoid;
	mso-outline-level:2;
	font-size:13.0pt;
	font-family:"Cambria","serif";
	mso-ascii-font-family:cambria;
	mso-ascii-theme-font:major-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:major-fareast;
	mso-hansi-font-family:cambria;
	mso-hansi-theme-font:major-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:major-bidi;
	color:#4f81bd;
	mso-themecolor:accent1;}
p.msolistparagraph, li.msolistparagraph, div.msolistparagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
p.msolistparagraphcxspfirst, li.msolistparagraphcxspfirst, div.msolistparagraphcxspfirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
p.msolistparagraphcxspmiddle, li.msolistparagraphcxspmiddle, div.msolistparagraphcxspmiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
p.msolistparagraphcxsplast, li.msolistparagraphcxsplast, div.msolistparagraphcxsplast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
span.heading2char
	{mso-style-name:"Heading 2 Char";
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:"Heading 2";
	mso-ansi-font-size:13.0pt;
	mso-bidi-font-size:13.0pt;
	font-family:"Cambria","serif";
	mso-ascii-font-family:cambria;
	mso-ascii-theme-font:major-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:major-fareast;
	mso-hansi-font-family:cambria;
	mso-hansi-theme-font:major-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:major-bidi;
	color:#4f81bd;
	mso-themecolor:accent1;
	font-weight:bold;}
span.heading1char
	{mso-style-name:"Heading 1 Char";
	mso-style-priority:9;
	mso-style-unhide:no;
	mso-style-locked:yes;
	mso-style-link:"Heading 1";
	mso-ansi-font-size:14.0pt;
	mso-bidi-font-size:14.0pt;
	font-family:"Cambria","serif";
	mso-ascii-font-family:cambria;
	mso-ascii-theme-font:major-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:major-fareast;
	mso-hansi-font-family:cambria;
	mso-hansi-theme-font:major-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:major-bidi;
	color:#376092;
	mso-themecolor:accent1;
	mso-themeshade:191;
	font-weight:bold;}
span.spelle
	{mso-style-name:"";
	mso-spl-e:yes;}
span.grame
	{mso-style-name:"";
	mso-gram-e:yes;}
.msochpdefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.msopapdefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page wordsection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.wordsection1
	{page:wordsection1;}
 /* List Definitions */
 @list l0
	{mso-list-id:532765045;
	mso-list-type:hybrid;
	mso-list-template-ids:1278381320 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1
	{mso-list-id:1292439424;
	mso-list-type:hybrid;
	mso-list-template-ids:-1918311336 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level5
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level6
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1:level7
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level8
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level9
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--></style>  <p class="WordSection1"></p>  <p class="WordSection1">Have you already started developing web apps on the new ASP.NET MVC framework? If yes, then you may be wondering how ASP.NET MVC framework works. Here is an walkthrough to dive you deep into the framework‘s internal concepts. </p>  <p class="WordSection1">MVC framework is not new but one of the most popular design pattern for UI driven applications. Microsoft has created this wonderful support to allow you develop ASP.NET application based on MVC design patterns.</p>  <p class="WordSection1">In order to complete this topic, you must have a working knowledge of ASP.NET Internals. (At least you understand how asp.net works). If not grab a copy of ASP.NET Internals and make yourself familiarized with the core framework.</p>  <p class="WordSection1">In this exercise I will use a default MVC project created with ASP.NET MVC 1.0 Web Application project template. The core concept of MVC relies on <span class="SpellE">HttpModule</span> &amp; <span class="SpellE">HttpHandler</span>. Although the article is reasonably lengthy, I have tried to cut code short by removing the part of the code out of discussion and keeping focus on highlighted portion.</p>  <p class="WordSection1">When you open up the <span class="SpellE">web.config</span> file in the MVC project, you will notice a reference of <span class="SpellE">HTTPHandler</span> and <span class="SpellE">HttpModule</span> as highlighted below in the <span class="SpellE">system.web</span>/<span class="SpellE">httpHandlers</span> and <span class="SpellE">httpModules</span>.</p>  <div class="WordSection1">   <ol>     <li><span class="SpellE">HttpHandler</span> (path=&quot;*.<span class="SpellE">mvc</span>&quot; validate=&quot;false&quot; type=&quot;<span class="SpellE">System.Web.Mvc.MvcHttpHandler</span>”), this handler reference here has not much importance in the context unless you mapped <span class="SpellE">urls</span> that ends with .<span class="SpellE">mvc</span></li>      <ol>       <li>This is mostly used in IIS 6 and other scenarios where wildcard mapping for ISAPI Extensions does not work well, or you have specific preference to keep <span class="SpellE">urls</span> end with .<span class="SpellE">mvc</span></li>        <li>Unless you have above constraint, you can remove the entry above from <span class="SpellE">web.config</span> file. </li>        <li><span class="SpellE">HttpModule</span> (name=&quot;<span class="SpellE">UrlRoutingModule</span>&quot; type=&quot;<span class="SpellE">System.Web.Routing.UrlRoutingModule</span>”), The most critical part of Routing used by MVC framework in ASP.NET </li>     </ol>      <li>Routing was introduced as part of ASP.NET 3.5 extensions to support dynamics <span class="SpellE"><span class="GramE">url</span></span>.</li>      <ol>       <li>This allows incoming <span class="SpellE">urls</span> to map with custom Http Handler based on URL patterns and various custom filters.</li>        <li>For routing to work, you must add an assembly reference to <span class="SpellE"><b style="mso-bidi-font-weight: normal">System.Web.Routing</b></span> to your project.</li>     </ol>   </ol> </div>  <p>We discussed about routing in little more details below.</p>  <h2><span class="SpellE">web.config</span></h2>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">system.web</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">siteMap/</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">compilation</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">debug</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">true</span>&quot;/<span style="color: blue">&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">authentication</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">mode</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">Windows</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">customErrors</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">mode</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">Off</span>&quot;/<span style="color: blue">&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">pages</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">controls/</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">namespaces</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">namespace</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">System.Web.Mvc</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">namespace</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">System.Web.Mvc.Ajax</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">namespace</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">System.Web.Mvc.Html</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">namespace</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">System.Web.Routing</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;/</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">namespaces</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;/</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">pages</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">httpHandlers</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">remove</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">verb</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">*</span>&quot;<span style="color: blue"> </span><span style="color: red">path</span><span style="color: blue">=</span>&quot;<span style="color: blue">*.asmx</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">verb</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">*</span>&quot;<span style="color: blue"> </span><span style="color: red">path</span><span style="color: blue">=</span>&quot;<span style="color: blue">*.asmx</span>&quot;<span style="color: blue"> </span><span style="color: red">validate</span><span style="color: blue">=</span>&quot;<span style="color: blue">false</span>&quot;<span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>&quot;<span style="color: blue">System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">verb</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">*</span>&quot;<span style="color: blue"> </span><span style="color: red">path</span><span style="color: blue">=</span>&quot;<span style="color: blue">*_AppService.axd</span>&quot;<span style="color: blue"> </span><span style="color: red">validate</span><span style="color: blue">=</span>&quot;<span style="color: blue">false</span>&quot;<span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>&quot;<span style="color: blue">System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">verb</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">GET,HEAD</span>&quot;<span style="color: blue"> </span><span style="color: red">path</span><span style="color: blue">=</span>&quot;<span style="color: blue">ScriptResource.axd</span>&quot;<span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>&quot;<span style="color: blue">System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35</span>&quot;<span style="color: blue"> </span><span style="color: red">validate</span><span style="color: blue">=</span>&quot;<span style="color: blue">false</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; mso-highlight: yellow">&lt;</span></span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: #a31515; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">add</span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: blue; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"> </span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: red; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">verb</span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: blue; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">=</span><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">&quot;<span style="color: blue">*</span>&quot;<span style="color: blue"> </span><span style="color: red">path</span><span style="color: blue">=</span>&quot;<span style="color: blue">*.mvc</span>&quot;<span style="color: blue"> </span><span style="color: red">validate</span><span style="color: blue">=</span>&quot;<span style="color: blue">false</span>&quot;<span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>&quot;<span style="color: blue">System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35</span>&quot;<span style="color: blue"> /&gt;</span></span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;/</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">httpHandlers</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">httpModules</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">add</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"> </span><span style="font-family: &quot;Courier New&quot;; color: red; font-size: 10pt; mso-no-proof: yes">name</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">=</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">&quot;<span style="color: blue">ScriptModule</span>&quot;<span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>&quot;<span style="color: blue">System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35</span>&quot;<span style="color: blue"> /&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; mso-highlight: yellow">&lt;</span></span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: #a31515; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">add</span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: blue; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"> </span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: red; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">name</span><span style="font-family: &quot;Courier New&quot;; background: yellow; color: blue; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">=</span><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow">&quot;<span style="color: blue">UrlRoutingModule</span>&quot;<span style="color: blue"> </span><span style="color: red">type</span><span style="color: blue">=</span>&quot;<span style="color: blue">System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35</span>&quot;<span style="color: blue"> /&gt;</span></span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>&lt;/</span><span style="font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">httpModules</span><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p class="MsoNormal"><span style="line-height: 115%; font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>&lt;/</span><span style="line-height: 115%; font-family: &quot;Courier New&quot;; color: #a31515; font-size: 10pt; mso-no-proof: yes">system.web</span><span style="line-height: 115%; font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">&gt;     <p></p>   </span></p>  <p class="MsoNormal">The below routing map sample can be found in the default <span class="SpellE">Global.asax</span> file. ASP.NET MVC applications typically register controller routes in <span class="SpellE">Application_Start</span> event of <span class="SpellE">Global.asax</span>.     <br style="mso-special-character: line-break" />    <br style="mso-special-character: line-break" /><span style="mso-no-proof: yes">     <p></p>   </span></p>  <h2><span style="mso-no-proof: yes">Global.asax     <p></p>   </span></h2>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">class</span> <span style="color: #2b91af">MvcApplication</span> : System.Web.<span style="color: #2b91af">HttpApplication       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> RegisterRoutes(<span style="color: #2b91af">RouteCollection</span> routes){      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>routes.IgnoreRoute(<span style="color: #a31515">&quot;{resource}.axd/{*pathInfo}&quot;</span>);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160; </span><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; mso-highlight: yellow">routes.MapRoute(       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #a31515">&quot;Default&quot;</span>,<span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Route name       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #a31515">&quot;{controller}/{action}/{id}&quot;</span>,<span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// URL with parameters       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">new</span> { controller = <span style="color: #a31515">&quot;Home&quot;</span>, action = <span style="color: #a31515">&quot;Index&quot;</span>, id = <span style="color: #a31515">&quot;&quot;</span> }<span style="mso-spacerun: yes">&#160; </span><span style="color: green">// Parameter defaults</span></span><span style="font-family: &quot;Courier New&quot;; color: green; font-size: 10pt; mso-no-proof: yes">     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">void</span> Application_Start(){      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>RegisterRoutes(<span style="color: #2b91af">RouteTable</span>.Routes);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p class="MsoNormal"><span style="line-height: 115%; font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p class="MsoNormal">You make use of <span class="SpellE"><b style="mso-bidi-font-weight: normal">RouteCollectionExtensions</b></span> to simplify the task of route mapping. When you use <span class="SpellE">route.MapRoute</span>, actually you add new Route instance of <span class="SpellE">MVCRouteHandler</span> type. Although Routing is part of ASP.NET 3.5 Extension, MVC is not. So you must add an assembly reference of <span class="SpellE"><b style="mso-bidi-font-weight: normal">System.Web.Mvc</b></span> to get access to this extension &amp; <span class="SpellE">MvcRouteHandler</span>.<span style="mso-no-proof: yes">     <p></p>   </span></p>  <h2><span style="mso-no-proof: yes">RouteCollectionExtensions     <p></p>   </span></h2>  <p class="MsoNormal">   <p>&#160;</p> </p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">class</span> <span style="color: #2b91af">RouteCollectionExtensions       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> IgnoreRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> url);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: blue">void</span> IgnoreRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> url, <span style="color: blue">object</span> constraints);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">Route</span> MapRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> name, <span style="color: blue">string</span> url);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">Route</span> MapRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> name, <span style="color: blue">string</span> url, <span style="color: blue">object</span> defaults);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">Route</span> MapRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> name, <span style="color: blue">string</span> url, <span style="color: blue">string</span>[] namespaces);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">Route</span> MapRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> name, <span style="color: blue">string</span> url, <span style="color: blue">object</span> defaults, <span style="color: blue">object</span> constraints);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">Route</span> MapRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> name, <span style="color: blue">string</span> url, <span style="color: blue">object</span> defaults, <span style="color: blue">string</span>[] namespaces);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">static</span> <span style="color: #2b91af">Route</span> MapRoute(<span style="color: blue">this</span> <span style="color: #2b91af">RouteCollection</span> routes, <span style="color: blue">string</span> name, <span style="color: blue">string</span> url, <span style="color: blue">object</span> defaults, <span style="color: blue">object</span> constraints, <span style="color: blue">string</span>[] namespaces) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (routes == <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">ArgumentNullException</span>(<span style="color: #a31515">&quot;routes&quot;</span>);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (url == <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">ArgumentNullException</span>(<span style="color: #a31515">&quot;url&quot;</span>);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; color: #2b91af; mso-highlight: yellow">Route</span><span style="background: yellow; mso-highlight: yellow"> item = <span style="color: blue">new</span> <span style="color: #2b91af">Route</span>(url, <span style="color: blue">new</span> <b style="mso-bidi-font-weight: normal"><span style="color: #2b91af">MvcRouteHandler</span></b>()){        <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160; </span>Defaults = <span style="color: blue">new</span> <span style="color: #2b91af">RouteValueDictionary</span>(defaults),      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>Constraints = <span style="color: blue">new</span> <span style="color: #2b91af">RouteValueDictionary</span>(constraints)      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>};</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> ((namespaces != <span style="color: blue">null</span>) &amp;&amp; (namespaces.Length &gt; 0)) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>item.DataTokens = <span style="color: blue">new</span> <span style="color: #2b91af">RouteValueDictionary</span>();      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>item.DataTokens[<span style="color: #a31515">&quot;Namespaces&quot;</span>] = namespaces;      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>routes.Add(name, item);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">return</span> item;      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">private</span> <span style="color: blue">sealed</span> <span style="color: blue">class</span> <span style="color: #2b91af">IgnoreRouteInternal</span> : <span style="color: #2b91af">Route       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> IgnoreRouteInternal(<span style="color: blue">string</span> url);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">override</span> <span style="color: #2b91af">VirtualPathData</span> GetVirtualPath(<span style="color: #2b91af">RequestContext</span> requestContext, <span style="color: #2b91af">RouteValueDictionary</span> routeValues);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p class="MsoNormal"><span style="line-height: 115%; font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <h2>URL Routing Module</h2>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p class="MsoNormal"><span style="mso-no-proof: yes">The key part of routing happens in the </span><span style="line-height: 115%; font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">PostMapRequestHandler, PostResolveRequestCache(In case of cached results)</span><span style="mso-no-proof: yes"> events of the HttpModule.     <p></p>   </span></p>  <p style="text-indent: -0.25in; mso-list: l0 level1 lfo2" class="MsoListParagraphCxSpFirst"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes"><span style="mso-list: ignore">1.<span style="font: 7pt &quot;Times New Roman&quot;">&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="mso-no-proof: yes">It finds specific Route by matching the request context. The matching works based on different factors such as the url &amp; input parameters.     <p></p>   </span></p>  <p style="text-indent: -0.25in; mso-list: l0 level1 lfo2" class="MsoListParagraphCxSpMiddle"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes"><span style="mso-list: ignore">2.<span style="font: 7pt &quot;Times New Roman&quot;">&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="mso-no-proof: yes">Then it tries to retreive the RouteHandler from the Route.     <p></p>   </span></p>  <p style="text-indent: -0.25in; mso-list: l0 level1 lfo2" class="MsoListParagraphCxSpLast"><span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-no-proof: yes"><span style="mso-list: ignore">3.<span style="font: 7pt &quot;Times New Roman&quot;">&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="mso-no-proof: yes">And this inturn sets the HttpContext.Handler to new instance of IHttpHandler from IRouteHandler.     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; color: blue; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>public</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"> <span style="color: blue">class</span> <span style="color: #2b91af">UrlRoutingModule</span> : <span style="color: #2b91af">IHttpModule       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">static</span> UrlRoutingModule();      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> UrlRoutingModule();      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> Dispose();      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> Init(<span style="color: #2b91af">HttpApplication</span> application);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">private</span> <span style="color: blue">void</span> OnApplicationPostMapRequestHandler(<span style="color: blue">object</span> sender, <span style="color: #2b91af">EventArgs</span> e);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">private</span> <span style="color: blue">void</span> OnApplicationPostResolveRequestCache(<span style="color: blue">object</span> sender, <span style="color: #2b91af">EventArgs</span> e);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes">&#160;&#160; </span>      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> Assigns the HTTP handler for the current request to the context.       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> PostMapRequestHandler(<span style="color: #2b91af">HttpContextBase</span> context) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; color: #2b91af; mso-highlight: yellow">RequestData</span><span style="background: yellow; mso-highlight: yellow"> data = (<span style="color: #2b91af">RequestData</span>)context.Items[_requestDataKey];        <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (data != <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>context.RewritePath(data.OriginalPath);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>context.Handler = data.HttpHandler;      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> Matches the HTTP request to a route, retrieves the handler for that route, and sets the handler as the HTTP handler for the current request.       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> PostResolveRequestCache(<span style="color: #2b91af">HttpContextBase</span> context) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; color: #2b91af; mso-highlight: yellow">RouteData</span><span style="background: yellow; mso-highlight: yellow"> routeData = <span style="color: blue">this</span>.RouteCollection.<b style="mso-bidi-font-weight: normal">GetRouteData</b>(context);</span>      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (routeData != <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #2b91af">IRouteHandler</span> routeHandler = routeData.RouteHandler;      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (routeHandler == <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">InvalidOperationException</span>(<span style="color: blue">string</span>.Format(<span style="color: #2b91af">CultureInfo</span>.CurrentUICulture, RoutingResources.UrlRoutingModule_NoRouteHandler, <span style="color: blue">new</span> <span style="color: blue">object</span>[0]));      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (!(routeHandler <span style="color: blue">is</span> <span style="color: #2b91af">StopRoutingHandler</span>)) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #2b91af">RequestContext</span> requestContext = <span style="color: blue">new</span> <span style="color: #2b91af">RequestContext</span>(context, routeData);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; color: #2b91af; mso-highlight: yellow">IHttpHandler</span><span style="background: yellow; mso-highlight: yellow"> httpHandler = routeHandler.<b style="mso-bidi-font-weight: normal">GetHttpHandler</b>(requestContext);</span>      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (httpHandler == <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">InvalidOperationException</span>(<span style="color: blue">string</span>.Format(<span style="color: #2b91af">CultureInfo</span>.CurrentUICulture, RoutingResources.UrlRoutingModule_NoHttpHandler, <span style="color: blue">new</span> <span style="color: blue">object</span>[] { routeHandler.GetType() }));      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>context.Items[_requestDataKey] = <span style="color: blue">new</span> <span style="color: #2b91af">RequestData</span> { OriginalPath = context.Request.Path, HttpHandler = httpHandler };      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>context.RewritePath(<span style="color: #a31515">&quot;~/UrlRouting.axd&quot;</span>);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;summary&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> Initializes a module and prepares it to handle requests.       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/summary&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;param name=&quot;application&quot;&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> An object that provides access to the methods, properties, and events common to all application objects in an ASP.NET application.       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray">///</span><span style="color: green"> </span><span style="color: gray">&lt;/param&gt;       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> Init(<span style="color: #2b91af">HttpApplication</span> application) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>application.PostResolveRequestCache += <span style="color: blue">new</span> <span style="color: #2b91af">EventHandler</span>(<span style="color: blue">this</span>.OnApplicationPostResolveRequestCache);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>application.PostMapRequestHandler += <span style="color: blue">new</span> <span style="color: #2b91af">EventHandler</span>(<span style="color: blue">this</span>.OnApplicationPostMapRequestHandler);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: #2b91af">RouteCollection</span> RouteCollection { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">private</span> <span style="color: blue">class</span> <span style="color: #2b91af">RequestData       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: #2b91af">IHttpHandler</span> HttpHandler { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">string</span> OriginalPath { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p class="MsoNormal"><span style="line-height: 115%; font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p class="MsoNormal"><span style="mso-no-proof: yes">MVCRouteHandler created new instance of MVCHandler when requested through GetHttpHandler method.     <p></p>   </span></p>  <h2><span style="mso-no-proof: yes">MvcRouteHandler     <p></p>   </span></h2>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">class</span> <span style="color: #2b91af">MvcRouteHandler</span> : <span style="color: #2b91af">IRouteHandler       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green">// Methods       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">virtual</span> <span style="color: #2b91af">IHttpHandler</span> GetHttpHandler(<span style="color: #2b91af">RequestContext</span> requestContext) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; color: blue; mso-highlight: yellow">return</span><span style="background: yellow; mso-highlight: yellow"> <span style="color: blue">new</span> <span style="color: #2b91af">MvcHandler</span>(requestContext);</span>      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p class="MsoNormal"><span style="mso-no-proof: yes">Here is magic. ASP.NET Runtime pipeline calles the ProcesRequest method of MvcHandler (HttpHandler)</span><span style="line-height: 115%; font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p></p>   </span></p>  <h2><span style="mso-no-proof: yes">MvcHandler     <p></p>   </span></h2>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: blue">class</span> <span style="color: #2b91af">MvcHandler</span> : System.Web.<span style="color: #2b91af">IHttpHandler</span>, <span style="color: #2b91af">IRequiresSessionState       <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">private</span> <span style="color: #2b91af">ControllerBuilder</span> _controllerBuilder;      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span><span style="mso-spacerun: yes">&#160;&#160;&#160; </span><span style="color: blue">static</span> MvcHandler();      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> MvcHandler(<span style="color: #2b91af">RequestContext</span> requestContext);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> ProcessRequest(<span style="color: #2b91af">HttpContext</span> httpContext) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #2b91af">HttpContextBase</span> base2 = <span style="color: blue">new</span> <span style="color: #2b91af">HttpContextWrapper</span>(httpContext);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">this</span>.ProcessRequest(base2);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">internal</span> <span style="color: blue">virtual</span> <span style="color: blue">void</span> ProcessRequest(<span style="color: #2b91af">HttpContextBase</span> httpContext) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">this</span>.AddVersionHeader(httpContext);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">string</span> requiredString = <span style="color: blue">this</span>.RequestContext.RouteData.GetRequiredString(<span style="color: #a31515">&quot;controller&quot;</span>);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; color: #2b91af; mso-highlight: yellow">IControllerFactory</span><span style="background: yellow; mso-highlight: yellow"> controllerFactory = <span style="color: blue">this</span>.ControllerBuilder.GetControllerFactory();        <p></p>     </span></span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; background: yellow; font-size: 10pt; mso-no-proof: yes; mso-highlight: yellow"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: #2b91af">IController</span> controller = controllerFactory.CreateController(<span style="color: blue">this</span>.RequestContext, requiredString);</span><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (controller == <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">throw</span> <span style="color: blue">new</span> <span style="color: #2b91af">InvalidOperationException</span>(      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">string</span>.Format(<span style="color: #2b91af">CultureInfo</span>.CurrentUICulture, MvcResources.ControllerBuilder_FactoryReturnedNull,      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">new</span> <span style="color: blue">object</span>[] { controllerFactory.GetType(), requiredString }));      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes">&#160;</span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">try</span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; mso-highlight: yellow">controller.Execute(<span style="color: blue">this</span>.RequestContext);</span>      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">finally</span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>controllerFactory.ReleaseController(controller);      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">protected</span> <span style="color: blue">virtual</span> <span style="color: blue">bool</span> IsReusable{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160; </span><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">get</span>{<span style="color: blue">return</span> <span style="color: blue">false</span>;}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}       <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">public</span> <span style="color: #2b91af">RequestContext</span> RequestContext { <span style="color: blue">get</span>; <span style="color: blue">private</span> <span style="color: blue">set</span>; }      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes">     <p>&#160;</p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">internal</span> <span style="color: #2b91af">ControllerBuilder</span> ControllerBuilder{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">get</span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">if</span> (<span style="color: blue">this</span>._controllerBuilder == <span style="color: blue">null</span>) {      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="background: yellow; color: blue; mso-highlight: yellow">this</span><span style="background: yellow; mso-highlight: yellow">._controllerBuilder = <span style="color: #2b91af">ControllerBuilder</span>.Current;</span>      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">return</span> <span style="color: blue">this</span>._controllerBuilder;      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">set</span>{      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue">this</span>._controllerBuilder = <span style="color: blue">value</span>;      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>}      <p></p>   </span></p>  <p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="font-family: &quot;Courier New&quot;; font-size: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&#160;&#160;&#160; </span>}      <p></p>  