The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HomeAreaRegistration.cs 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System.Collections.Generic;
  2. using System.Web.Mvc;
  3. using System.Web.Optimization;
  4. using Teknik;
  5. using Teknik.Configuration;
  6. using Teknik.Controllers;
  7. using Teknik.Helpers;
  8. namespace Teknik.Areas.Home
  9. {
  10. public class HomeAreaRegistration : AreaRegistration
  11. {
  12. public override string AreaName
  13. {
  14. get
  15. {
  16. return "Home";
  17. }
  18. }
  19. public override void RegisterArea(AreaRegistrationContext context)
  20. {
  21. Config config = Config.Load();
  22. // Default Routes to be applied everywhere
  23. context.MapSubdomainRoute(
  24. "Default.Favicon", // Route name
  25. new List<string>() { "*" }, // Subdomains
  26. new List<string>() { config.Host, config.ShortenerConfig.ShortenerHost }, // domains
  27. "favicon.ico", // URL with parameters
  28. new { controller = "Default", action = "Favicon" }, // Parameter defaults
  29. new[] { typeof(DefaultController).Namespace }
  30. );
  31. // Default Routes to be applied everywhere
  32. context.MapSubdomainRoute(
  33. "Default.Logo", // Route name
  34. new List<string>() { "*" }, // Subdomains
  35. new List<string>() { config.Host, config.ShortenerConfig.ShortenerHost }, // domains
  36. "Logo", // URL with parameters
  37. new { controller = "Default", action = "Logo" }, // Parameter defaults
  38. new[] { typeof(DefaultController).Namespace }
  39. );
  40. // Register fallback for all bad requests
  41. context.MapSubdomainRoute(
  42. "Default.NotFound", // Route name
  43. new List<string>() { "*" }, // Subdomains
  44. new List<string>() { config.Host }, // domains
  45. "{url}", // URL with parameters
  46. new { controller = "Default", action = "NotFound" }, // Parameter defaults
  47. new { url = "{*url}" },
  48. new[] { typeof(DefaultController).Namespace }
  49. );
  50. context.MapSubdomainRoute(
  51. "Home.Index", // Route name
  52. new List<string>() { "www", string.Empty }, // Subdomains
  53. new List<string>() { config.Host }, // domains
  54. "", // URL with parameters
  55. new { controller = "Home", action = "Index" }, // Parameter defaults
  56. new[] { typeof(Controllers.HomeController).Namespace }
  57. );
  58. // Register Style Bundles
  59. BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/home", config.CdnHost).Include(
  60. "~/Areas/Home/Content/Home.css"));
  61. }
  62. }
  63. }