コード例 #1
0
 public override void RegisterArea(AreaRegistrationContext context)
 {
     Config config = Config.Load();
     context.MapSubdomainRoute(
          "Error.Http404", // Route name
          new List<string>() { "*", "error" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "404",    // URL with parameters 
          new { controller = "Error", action = "Http404" },  // Parameter defaults 
          new[] { typeof(Controllers.ErrorController).Namespace }
      );
     context.MapSubdomainRoute(
          "Error.Http403", // Route name
          new List<string>() { "*", "error" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "403",    // URL with parameters 
          new { controller = "Error", action = "Http403" },  // Parameter defaults 
          new[] { typeof(Controllers.ErrorController).Namespace }
      );
     context.MapSubdomainRoute(
          "Error.Http500", // Route name
          new List<string>() { "*", "error" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "500",    // URL with parameters 
          new { controller = "Error", action = "Http500" },  // Parameter defaults 
          new[] { typeof(Controllers.ErrorController).Namespace }
      );
 }
コード例 #2
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Shortener.Index", // Route name
                 new List<string>() { "shorten", "s" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "",    // URL with parameters 
                 new { controller = "Shortener", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.ShortenerController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Shortener.Action", // Route name
                 new List<string>() { "shorten", "s" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Action/{action}",    // URL with parameters 
                 new { controller = "Shortener", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.ShortenerController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Shortener.View", // Route name
                 new List<string>() { string.Empty, "shortened" }, // Subdomains
                 new List<string>() { config.ShortenerConfig.ShortenerHost }, // domains
                 "{url}",    // URL with parameters 
                 new { controller = "Shortener", action = "RedirectToUrl" },  // Parameter defaults 
                 new[] { typeof(Controllers.ShortenerController).Namespace }
             );

            // Register Script Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/shortener", config.CdnHost).Include(
                      "~/Areas/Shortener/Scripts/Shortener.js"));
        }
コード例 #3
0
 public override void RegisterArea(AreaRegistrationContext context)
 {
     Config config = Config.Load();
     context.MapSubdomainRoute(
          "RSS.Index", // Route name
          new List<string>() { "rss" },
          new List<string>() { config.Host }, // domains
          "",    // URL with parameters 
          new { controller = "RSS", action = "Index" },  // Parameter defaults 
          new[] { typeof(Controllers.RSSController).Namespace }
      );
     context.MapSubdomainRoute(
          "RSS.Blog", // Route name
          new List<string>() { "rss" },
          new List<string>() { config.Host }, // domains
          "Blog/{username}",    // URL with parameters 
          new { controller = "RSS", action = "Blog", username = UrlParameter.Optional },  // Parameter defaults 
          new[] { typeof(Controllers.RSSController).Namespace }
      );
     context.MapSubdomainRoute(
          "RSS.Podcast", // Route name
          new List<string>() { "rss" },
          new List<string>() { config.Host }, // domains
          "Podcast",    // URL with parameters 
          new { controller = "RSS", action = "Podcast" },  // Parameter defaults 
          new[] { typeof(Controllers.RSSController).Namespace }
      );
 }
コード例 #4
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Blog.Blog", // Route name
                 new List<string>() { "blog" }, // Subdomains
                 new List<string>() { config.Host },
                 "{username}",    // URL with parameters 
                 new { controller = "Blog", action = "Blog", username = string.Empty },  // Parameter defaults 
                 new[] { typeof(Controllers.BlogController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Blog.New", // Route name
                 new List<string>() { "blog" }, // Subdomains
                 new List<string>() { config.Host },
                 "{username}/New",    // URL with parameters 
                 new { controller = "Blog", action = "NewPost", username = "" },  // Parameter defaults 
                 new[] { typeof(Controllers.BlogController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Blog.Edit", // Route name
                 new List<string>() { "blog" }, // Subdomains
                 new List<string>() { config.Host },
                 "{username}/Edit/{id}",    // URL with parameters 
                 new { controller = "Blog", action = "EditPost", username = "", id = 0 },  // Parameter defaults 
                 new[] { typeof(Controllers.BlogController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Blog.Post", // Route name
                 new List<string>() { "blog" }, // Subdomains
                 new List<string>() { config.Host },
                 "{username}/p/{id}",    // URL with parameters 
                 new { controller = "Blog", action = "Post", username = "", id = 0 },  // Parameter defaults 
                 new[] { typeof(Controllers.BlogController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Blog.Action", // Route name
                 new List<string>() { "blog" }, // Subdomains
                 new List<string>() { config.Host },
                 "Action/{controller}/{action}",    // URL with parameters 
                 new { controller = "Blog", action = "Blog" },  // Parameter defaults 
                 new[] { typeof(Controllers.BlogController).Namespace }
             );

            // Register Script Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/blog", config.CdnHost).Include(
                      "~/Scripts/bootbox/bootbox.min.js",
                      "~/Scripts/MarkdownDeepLib.min.js",
                      "~/Areas/Blog/Scripts/Blog.js"));
            // Register Style Bundles
            BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/blog", config.CdnHost).Include(
                      "~/Content/mdd_styles.css",
                      "~/Areas/Blog/Content/Blog.css"));
        }
コード例 #5
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            #region API v1
            // Base Routing
            context.MapSubdomainRoute(
                 "API.v1.Index", // Route name
                 new List<string>() { "api" },
                 new List<string>() { config.Host },
                 "v1",    // URL with parameters 
                 new { controller = "APIv1", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.APIv1Controller).Namespace }
             );
            // Uploads
            context.MapSubdomainRoute(
                 "API.v1.Upload", // Route name
                 new List<string>() { "api" },
                 new List<string>() { config.Host },
                 "v1/Upload",    // URL with parameters 
                 new { controller = "APIv1", action = "Upload" },  // Parameter defaults 
                 new[] { typeof(Controllers.APIv1Controller).Namespace }
             );
            // Pastes
            context.MapSubdomainRoute(
                 "API.v1.Paste", // Route name
                 new List<string>() { "api" },
                 new List<string>() { config.Host },
                 "v1/Paste",    // URL with parameters 
                 new { controller = "APIv1", action = "Paste" },  // Parameter defaults 
                 new[] { typeof(Controllers.APIv1Controller).Namespace }
             );
            // Url Shortening
            context.MapSubdomainRoute(
                 "API.v1.Shortener", // Route name
                 new List<string>() { "api" },
                 new List<string>() { config.Host },
                 "v1/Shorten",    // URL with parameters 
                 new { controller = "APIv1", action = "Shorten" },  // Parameter defaults 
                 new[] { typeof(Controllers.APIv1Controller).Namespace }
             );
            #endregion

            // Default Routing
            context.MapSubdomainRoute(
                 "API.Index", // Route name
                 new List<string>() { "api" },
                 new List<string>() { config.Host },
                 "",    // URL with parameters 
                 new { controller = "API", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.APIController).Namespace }
             );
        }
コード例 #6
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();

            // Default Routes to be applied everywhere
            context.MapSubdomainRoute(
                 "Default.Favicon", // Route name
                 new List<string>() { "*" }, // Subdomains
                 new List<string>() { config.Host, config.ShortenerConfig.ShortenerHost }, // domains
                 "favicon.ico",    // URL with parameters 
                 new { controller = "Default", action = "Favicon" },  // Parameter defaults 
                 new[] { typeof(DefaultController).Namespace }
             );

            // Default Routes to be applied everywhere
            context.MapSubdomainRoute(
                 "Default.Logo", // Route name
                 new List<string>() { "*" }, // Subdomains
                 new List<string>() { config.Host, config.ShortenerConfig.ShortenerHost }, // domains
                 "Logo",    // URL with parameters 
                 new { controller = "Default", action = "Logo" },  // Parameter defaults 
                 new[] { typeof(DefaultController).Namespace }
             );

            // Register fallback for all bad requests
            context.MapSubdomainRoute(
                 "Default.NotFound", // Route name
                 new List<string>() { "*" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "{url}",    // URL with parameters 
                 new { controller = "Default", action = "NotFound" },  // Parameter defaults 
                 new { url = "{*url}" },
                 new[] { typeof(DefaultController).Namespace }
             );

            context.MapSubdomainRoute(
                 "Home.Index", // Route name
                 new List<string>() { "www", string.Empty }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "",    // URL with parameters 
                 new { controller = "Home", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.HomeController).Namespace }
             );

            // Register Style Bundles
            BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/home", config.CdnHost).Include(
                      "~/Areas/Home/Content/Home.css"));
        }
コード例 #7
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Podcast.Index", // Route name
                 new List<string>() { "podcast" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "",    // URL with parameters 
                 new { controller = "Podcast", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.PodcastController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Podcast.View", // Route name
                 new List<string>() { "podcast" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "{episode}",    // URL with parameters 
                 new { controller = "Podcast", action = "View" },  // Parameter defaults 
                 new[] { typeof(Controllers.PodcastController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Podcast.Download", // Route name
                 new List<string>() { "podcast" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "File/{episode}/{fileName}",    // URL with parameters 
                 new { controller = "Podcast", action = "Download" },  // Parameter defaults 
                 new[] { typeof(Controllers.PodcastController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Podcast.Action", // Route name
                 new List<string>() { "podcast" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Action/{controller}/{action}",    // URL with parameters 
                 new { controller = "Podcast", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.PodcastController).Namespace }
             );

            // Register Script Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/podcast", config.CdnHost).Include(
                      "~/Scripts/bootbox/bootbox.min.js",
                      "~/Scripts/jquery.blockUI.js",
                      "~/Areas/Podcast/Scripts/Podcast.js"));
            // Register Style Bundles
            BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/podcast", config.CdnHost).Include(
                      "~/Areas/Podcast/Content/Podcast.css"));
        }
コード例 #8
0
 public override void RegisterArea(AreaRegistrationContext context)
 {
     Config config = Config.Load();
     context.MapSubdomainRoute(
          "Stream.Index", // Route name
          new List<string>() { "stream" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "",    // URL with parameters 
          new { controller = "Stream", action = "Index" },  // Parameter defaults 
          new[] { typeof(Controllers.StreamController).Namespace }
      );
     context.MapSubdomainRoute(
          "Stream.View", // Route name
          new List<string>() { "stream" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "Stream/{id}",    // URL with parameters 
          new { controller = "Stream", action = "ViewStream" },  // Parameter defaults 
          new[] { typeof(Controllers.StreamController).Namespace }
      );
 }
コード例 #9
0
 public override void RegisterArea(AreaRegistrationContext context)
 {
     Config config = Config.Load();
     context.MapSubdomainRoute(
          "About.Index", // Route name
          new List<string>() { "about" },
          new List<string>() { config.Host },
          "",    // URL with parameters 
          new { controller = "About", action = "Index" },  // Parameter defaults 
          new[] { typeof(Controllers.AboutController).Namespace }
      );
 }
コード例 #10
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Admin.Dashboard", // Route name
                 new List<string>() { "admin" }, // Subdomains
                 new List<string>() { config.Host },
                 "",    // URL with parameters 
                 new { controller = "Admin", action = "Dashboard" },  // Parameter defaults 
                 new[] { typeof(Controllers.AdminController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Admin.Search", // Route name
                 new List<string>() { "admin" }, // Subdomains
                 new List<string>() { config.Host },
                 "Search",    // URL with parameters 
                 new { controller = "Admin", action = "Search" },  // Parameter defaults 
                 new[] { typeof(Controllers.AdminController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Admin.UserInfo", // Route name
                 new List<string>() { "admin" }, // Subdomains
                 new List<string>() { config.Host },
                 "User/{username}",    // URL with parameters 
                 new { controller = "Admin", action = "UserInfo", username = string.Empty },  // Parameter defaults 
                 new[] { typeof(Controllers.AdminController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Admin.Action", // Route name
                 new List<string>() { "admin" }, // Subdomains
                 new List<string>() { config.Host },
                 "Action/{controller}/{action}",    // URL with parameters 
                 new { controller = "Admin", action = "Dashboard" },  // Parameter defaults 
                 new[] { typeof(Controllers.AdminController).Namespace }
             );

            // Register Script Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/Search", config.CdnHost).Include(
                      "~/Areas/Admin/Scripts/Search.js"));
        }
コード例 #11
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Contact.Index", // Route name
                 new List<string>() { "contact" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "",    // URL with parameters 
                 new { controller = "Contact", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.ContactController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Contact.Action", // Route name
                 new List<string>() { "contact" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "{action}",    // URL with parameters 
                 new { controller = "Contact", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.ContactController).Namespace }
             );

            // Register Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/contact", config.CdnHost).Include(
                      "~/Areas/Contact/Scripts/Contact.js"));
        }
コード例 #12
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Vault.Index",
                 new List<string>() { "vault", "v" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "",
                 new { controller = "Vault", action = "Index" },
                 new[] { typeof(Controllers.VaultController).Namespace }
             );

            // Register Script Bundle
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/vault", config.CdnHost).Include(
                      "~/Areas/Vault/Scripts/Vault.js"));
        }
コード例 #13
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Help.Index", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "",    // URL with parameters 
                 new { controller = "Help", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.API", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "API/{version}/{service}",    // URL with parameters 
                 new { controller = "Help", action = "API", version = UrlParameter.Optional, service = UrlParameter.Optional },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.Blog", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Blog",    // URL with parameters 
                 new { controller = "Help", action = "Blog" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.Git", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Git",    // URL with parameters 
                 new { controller = "Help", action = "Git" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.IRC", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "IRC",    // URL with parameters 
                 new { controller = "Help", action = "IRC" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.Mail", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Mail",    // URL with parameters 
                 new { controller = "Help", action = "Mail" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.Markdown", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Markdown",    // URL with parameters 
                 new { controller = "Help", action = "Markdown" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.Mumble", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Mumble",    // URL with parameters 
                 new { controller = "Help", action = "Mumble" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.RSS", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "RSS",    // URL with parameters 
                 new { controller = "Help", action = "RSS" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.Tools", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Tools",    // URL with parameters 
                 new { controller = "Help", action = "Tools" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Help.Upload", // Route name
                 new List<string>() { "help" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Upload",    // URL with parameters 
                 new { controller = "Help", action = "Upload" },  // Parameter defaults 
                 new[] { typeof(Controllers.HelpController).Namespace }
             );

            // Register Style Bundles
            BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/help", config.CdnHost).Include(
                      "~/Areas/Help/Content/Help.css"));
        }
コード例 #14
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Upload.Index",
                 new List<string>() { "upload", "u" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "",  
                 new { controller = "Upload", action = "Index" },
                 new[] { typeof(Controllers.UploadController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Upload.Favicon",
                 new List<string>() { "upload", "u" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "favicon.ico",
                 new { controller = "Default", action = "Favicon" },
                 new[] { typeof(DefaultController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Upload.Download",
                 new List<string>() { "upload", "u" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "{file}",
                 new { controller = "Upload", action = "Download", file = string.Empty },
                 new[] { typeof(Controllers.UploadController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Upload.Delete",
                 new List<string>() { "upload", "u" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "{file}/{key}",
                 new { controller = "Upload", action = "Delete", file = string.Empty, key = string.Empty },
                 new[] { typeof(Controllers.UploadController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Upload.Action",
                 new List<string>() { "upload", "u" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Action/{controller}/{action}",
                 new { controller = "Upload", action = "Index" },
                 new[] { typeof(Controllers.UploadController).Namespace }
             );

            // Register Script Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/upload", config.CdnHost).Include(
                      "~/Scripts/Dropzone/dropzone.js",
                      "~/Areas/Upload/Scripts/Upload.js",
                      "~/Scripts/bootstrap-switch.js",
                      "~/Scripts/bootbox/bootbox.min.js"));
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/download", config.CdnHost).Include(
                      "~/Scripts/Blob.js",
                      "~/Scripts/FileSaver.js",
                      "~/Areas/Upload/Scripts/Download.js"));
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/cryptoWorker", config.CdnHost).Include(
                      "~/Areas/Upload/Scripts/EncryptionWorker.js"));
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/crypto", config.CdnHost).Include(
                      "~/Scripts/Crypto-js/aes.js",
                      "~/Scripts/Crypto-js/enc-base64.js",
                      "~/Scripts/Crypto-js/mode-ctr.js",
                      "~/Scripts/Crypto-js/lib-typedarrays.js",
                      "~/Scripts/Crypto-js/pad-nopadding.js"));

            // Register Style Bundles
            BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/upload", config.CdnHost).Include(
                      "~/Content/dropzone.css",
                      "~/Content/bootstrap-switch/bootstrap3/bootstrap-switch.css",
                      "~/Areas/Upload/Content/Upload.css"));
        }
コード例 #15
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "Paste.Index", // Route name
                 new List<string>() { "paste", "p" },
                 new List<string>() { config.Host }, // domains
                 "",    // URL with parameters 
                 new { controller = "Paste", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.PasteController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Paste.Favicon",
                 new List<string>() { "paste", "p" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "favicon.ico",
                 new { controller = "Default", action = "Favicon" },
                 new[] { typeof(DefaultController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Paste.Simple", // Route name
                 new List<string>() { "paste", "p" },
                 new List<string>() { config.Host }, // domains
                 "Simple/{url}",    // URL with parameters 
                 new { controller = "Paste", action = "ViewPaste", type = "Simple" },  // Parameter defaults 
                 new[] { typeof(Controllers.PasteController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Paste.Raw", // Route name
                 new List<string>() { "paste", "p" },
                 new List<string>() { config.Host }, // domains
                 "Raw/{url}",    // URL with parameters 
                 new { controller = "Paste", action = "ViewPaste", type = "Raw" },  // Parameter defaults 
                 new[] { typeof(Controllers.PasteController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Paste.Download", // Route name
                 new List<string>() { "paste", "p" },
                 new List<string>() { config.Host }, // domains
                 "Download/{url}",    // URL with parameters 
                 new { controller = "Paste", action = "ViewPaste", type = "Download" },  // Parameter defaults 
                 new[] { typeof(Controllers.PasteController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Paste.Action", // Route name
                 new List<string>() { "paste", "p" },
                 new List<string>() { config.Host }, // domains
                 "Action/{action}",    // URL with parameters 
                 new { controller = "Paste", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.PasteController).Namespace }
             );
            context.MapSubdomainRoute(
                 "Paste.View", // Route name
                 new List<string>() { "paste", "p" },
                 new List<string>() { config.Host }, // domains
                 "{url}",    // URL with parameters 
                 new { controller = "Paste", action = "ViewPaste", type = "Full" },  // Parameter defaults 
                 new[] { typeof(Controllers.PasteController).Namespace }
             );

            // Register Script Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/paste", config.CdnHost).Include(
                      "~/Scripts/Highlight/highlight.pack.js",
                      "~/Areas/Paste/Scripts/Paste.js"));
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/syntaxWorker", config.CdnHost).Include(
                      "~/Areas/Paste/Scripts/SyntaxWorker.js"));
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/highlight", config.CdnHost).Include(
                      "~/Scripts/Highlight/highlight.pack.js"));
            // Register Style Bundles
            BundleTable.Bundles.Add(new CdnScriptBundle("~/Content/paste", config.CdnHost).Include(
                      "~/Content/Highlight/github-gist.css",
                      "~/Areas/Paste/Content/Paste.css"));
        }
コード例 #16
0
        public override void RegisterArea(AreaRegistrationContext context)
        {
            Config config = Config.Load();
            context.MapSubdomainRoute(
                 "User.Login", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Login",    // URL with parameters 
                 new { controller = "User", action = "Login" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.Logout", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Logout",    // URL with parameters 
                 new { controller = "User", action = "Logout" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.Register", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Register",    // URL with parameters 
                 new { controller = "User", action = "Register" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.Settings", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Settings",    // URL with parameters 
                 new { controller = "User", action = "Settings" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.ResetPassword", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Reset/{username}",    // URL with parameters 
                 new { controller = "User", action = "ResetPassword", username = UrlParameter.Optional },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.VerifyResetPassword", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Reset/{username}/{code}",    // URL with parameters 
                 new { controller = "User", action = "VerifyResetPassword" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.VerifyRecoveryEmail", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "VerifyEmail/{code}",    // URL with parameters 
                 new { controller = "User", action = "VerifyRecoveryEmail" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.CheckAuthenticatorCode", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "CheckAuthCode",    // URL with parameters 
                 new { controller = "User", action = "ConfirmTwoFactorAuth" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.Index", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "u/{username}",    // URL with parameters 
                 new { controller = "User", action = "Index", username = UrlParameter.Optional },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.PGPKey", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "u/{username}/PGP",    // URL with parameters 
                 new { controller = "User", action = "ViewRawPGP" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );
            context.MapSubdomainRoute(
                 "User.Action", // Route name
                 new List<string>() { "user" }, // Subdomains
                 new List<string>() { config.Host }, // domains
                 "Action/{action}",    // URL with parameters 
                 new { controller = "User", action = "Index" },  // Parameter defaults 
                 new[] { typeof(Controllers.UserController).Namespace }
            );

            // Register Script Bundle
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/user", config.CdnHost).Include(
                      "~/Scripts/bootbox/bootbox.min.js",
                      "~/Scripts/jquery.blockUI.js",
                      "~/Scripts/bootstrap-switch.js",
                      "~/Areas/User/Scripts/User.js"));

            // Register Script Bundle
            BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/checkAuthCode", config.CdnHost).Include(
                      "~/Areas/User/Scripts/CheckAuthCode.js"));

            // Register Style Bundles
            BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/user", config.CdnHost).Include(
                      "~/Content/bootstrap-switch/bootstrap3/bootstrap-switch.css"));
        }