PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CSASPNETMVCCustomActionFilter/Global.asax.cs

#
C# | 57 lines | 25 code | 9 blank | 23 comment | 0 complexity | 0d6c285c0ec3fd83b8b12076769f64ed MD5 | raw file
 1/****************************** Module Header ******************************\
 2 * Module Name:  MessageModifierActionFilter.cs
 3 * Project:              CSASPNETMVCCustomActionFilter
 4 * Copyright (c) Microsoft Corporation.
 5 * 
 6 * The CSASPNETMVCCustomActionFilter sample demonstrates how to use C# codes to 
 7 * create custom ActionFilters for ASP.NET MVC web application. In this sample,
 8 * there are two custom ActionFilters, one is used for customizing ViewData
 9 * before page view result get executed and rendered; another is used for 
10 * perform logging within the various events during the processing of custom 
11 * ActionFilters.
12 * 
13 * 
14 * This source is subject to the Microsoft Public License.
15 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
16 * All other rights reserved.
17 * 
18 * History:
19 * * 10/10/2009 1:35 PM Steven Cheng Created
20 ***************************************************************************/
21
22
23
24using System;
25using System.Collections.Generic;
26using System.Linq;
27using System.Web;
28using System.Web.Mvc;
29using System.Web.Routing;
30
31namespace CSASPNETMVCCustomActionFilter
32{
33    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
34    // visit http://go.microsoft.com/?LinkId=9394801
35
36    public class MvcApplication : System.Web.HttpApplication
37    {
38        public static void RegisterRoutes(RouteCollection routes)
39        {
40            // Default code for registering MVC Url routering rules
41
42            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
43
44            routes.MapRoute(
45                "Default",                                              // Route name
46                "{controller}/{action}/{id}",                           // URL with parameters
47                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
48            );
49
50        }
51
52        protected void Application_Start()
53        {
54            RegisterRoutes(RouteTable.Routes);
55        }
56    }
57}