1. Intro
    1. Inbound Routing
      1. URL
      2. Routing System
      3. RouteData
      4. handled by MVC
    2. Outbound Routing
      1. Helper
      2. RouteData
      3. search the config
      4. construct the URL
  2. Demo
    1. when no Home controller root URL throws YSOD
    2. change default route config to Jobs
    3. Html.ActionLink
    4. add a Details Action
    5. clean up the URL
    6. new Routing entry routes.MapRoute()
    7. order of entries is respected
      1. put the most specific entries first
    8. may need a constraint (id should be digits only)
    9. to avoid conflicts with existing route configs
  3. Routes.MapRoute
    1. route name
    2. URL pattern
    3. defaults
      1. means that segments can then be optional
    4. constraints
      1. must be satisfied
    5. Outbound
      1. default-only treated as extra constraints
      2. extra params are appended to query string
  4. further features
    1. physical files on disk
      1. don't match the routing entries
      2. allows IIS to just serve the file
      3. RouteExistingFiles property
      4. Routes.IgnoreRoute
        1. to selectively white-list files to allow to be served
      5. catch-all params using *
        1. entire string after * matched so need to be the last segment in the URL
    2. named route entries
      1. helps with Outbound routing
      2. Html.RouteLink
      3. no guarantee they'll match incoming route
      4. prob. best to not use them
    3. custom route handlers
      1. e.g.
      2. IRouteHandler
      3. GetHttpHandler
      4. not reusable
      5. ProcessRequest
      6. routes.Add(new Route())
      7. parameters can be passed into the request processing
      8. prob. not all that useful
  5. SEO
    1. add an extension to a Model class to easily pull out potentially useful route params
    2. build a RouteValueDictionary
    3. import the namespace into a View
    4. Html.RouteLink
    5. generate URL from arbitrary list of route params
    6. update the routing config so that they really are params not just appended to querystring
    7. maybe no longer need the id any longer
    8. normalise the URL
      1. change null -> empty string
      2. replace whitespace (dashes)
      3. remove unusual characters
      4. this is OK if we still only rely on the id parameter
      5. non-canonicalisation problem
        1. only have a single URL mapping to a resource
        2. enforce canonical URLs
        3. add code to controller to compare
          1. Request.Url.PathAndQuery
          2. Url.RouteUrl(routeValueDictionary)
        4. redirect - do HTTP:301 (permanently moved)
  6. Areas
    1. a way of orgnaising the app
    2. have their own
      1. Controllers
      2. Views
      3. content files
      4. Routing config
    3. create area
      1. creates folder structure
      2. how does it work didn't add anything to Route config
      3. Application_Start
      4. new class inheriting from AreaRegistration
      5. RegisterArea
        1. Area registers it's own Routes
    4. problems?
      1. controllers with the same name
        1. conflicts at top-level
        2. equal priority to all namespaces
        3. need provide the namespace in the global Route config