All Projects → mariuszkerl → Aspnetcoresubdomain

mariuszkerl / Aspnetcoresubdomain

Licence: mit
Simple usage lib for subdomain routing in ASP.NET Core/Framework MVC

Projects that are alternatives of or similar to Aspnetcoresubdomain

k-domains
A simple module to manage multiple subdomains with just one project
Stars: ✭ 41 (-73.89%)
Mutual labels:  routing, subdomain
Run Aspnetcore Cqrs
Real world Enterprise CRM application example of ASP.NET Core + Angular web application. Implemented CQRS Design Pattern for ASP.NET Core + Angular reference application, demonstrating a layered application architecture with DDD best practices. Download 100+ page eBook PDF from here ->
Stars: ✭ 152 (-3.18%)
Mutual labels:  aspnetcore
Razorhtmlemails
Implementing HTML Emails with ASP.NET Core Razor
Stars: ✭ 143 (-8.92%)
Mutual labels:  aspnetcore
Aspnetcoresamples
This repository is set of ASP.NET Core projects and scripts.
Stars: ✭ 148 (-5.73%)
Mutual labels:  aspnetcore
Nextjs Dynamic Routes
[Deprecated] Super simple way to create dynamic routes with Next.js
Stars: ✭ 145 (-7.64%)
Mutual labels:  routing
Massdns
A high-performance DNS stub resolver for bulk lookups and reconnaissance (subdomain enumeration)
Stars: ✭ 2,093 (+1233.12%)
Mutual labels:  subdomain
Aspnetcore Angular Ngrx
🚀 An ASP.NET Core WebAPI Demo with an Angular Client using Ngrx store and effects and Signalr
Stars: ✭ 141 (-10.19%)
Mutual labels:  aspnetcore
Ccna60d
60天通过思科认证的网络工程师考试
Stars: ✭ 155 (-1.27%)
Mutual labels:  routing
Formhelper
ASP.NET Core - Transform server-side validations to client-side without writing any javascript code. (Compatible with Fluent Validation)
Stars: ✭ 155 (-1.27%)
Mutual labels:  aspnetcore
Aspnet Core 3 Signup Verification Api
ASP.NET Core 3.1 - Boilerplate API with Email Sign Up, Verification, Authentication & Forgot Password
Stars: ✭ 145 (-7.64%)
Mutual labels:  aspnetcore
Reservationserver
预约系统 ReservationSystem powered by asp.net core
Stars: ✭ 146 (-7.01%)
Mutual labels:  aspnetcore
Dntidentity
A highly customized sample of the ASP.NET Core Identity
Stars: ✭ 145 (-7.64%)
Mutual labels:  aspnetcore
Ng2 Pdfjs Viewer
An angular 8 component for PDFJS and ViewerJS (Supports angular 2/4/5/6/7)
Stars: ✭ 150 (-4.46%)
Mutual labels:  aspnetcore
Jhipster Dotnetcore
JHipster.NET blueprint
Stars: ✭ 144 (-8.28%)
Mutual labels:  aspnetcore
Gsdf
A domain searcher named GoogleSSLdomainFinder - 基于谷歌SSL透明证书的子域名查询工具
Stars: ✭ 155 (-1.27%)
Mutual labels:  subdomain
Frr
The FRRouting Protocol Suite
Stars: ✭ 2,009 (+1179.62%)
Mutual labels:  routing
Popforums
A forum application running on ASP.NET Core, available in six languages.
Stars: ✭ 145 (-7.64%)
Mutual labels:  aspnetcore
Dotnetcore
.NET 5 Nuget Packages.
Stars: ✭ 146 (-7.01%)
Mutual labels:  aspnetcore
Osharp
OSharp是一个基于.NetCore的快速开发框架,框架对 AspNetCore 的配置、依赖注入、日志、缓存、实体框架、Mvc(WebApi)、身份认证、功能权限、数据权限等模块进行更高一级的自动化封装,并规范了一套业务实现的代码结构与操作流程,使 .Net Core 框架更易于应用到实际项目开发中。
Stars: ✭ 2,151 (+1270.06%)
Mutual labels:  aspnetcore
Redux Tower
Saga powered routing engine for Redux app.
Stars: ✭ 155 (-1.27%)
Mutual labels:  routing
logo

NuGet

ASP.NET Subdomain Routing

Goal of that lib is to make subdomain routing easy to use in asp net core mvc applications. Normally you would use some custom route for some special case scenario in your app. This should solve most of issues while using subdomain routing. Inspired by couple of already existing libraries around the web which handle routing in some degree this should meet requirements:

  1. Register subdomain routes as you would do with normal routes.
  2. Make links, forms urls etc. in views as you would do with helpers in your cshtml pages.
  3. Catch all route values in controller.

Important note, this library does not work currently with the endpoint routing.

Continuous Integration

Build server Build status Unit tests Integration tests Functional tests
AppVeyor Build status Build status Build status Build status

Wiki

https://github.com/mariuszkerl/AspNetCoreSubdomain/wiki

Setup

Startup.cs

Your application have to be aware of using subdomains. Important thing is to use method AddSubdomains() before AddMvc()

public void ConfigureServices(IServiceCollection services)
{
    // Add framework services.
    //...
    services.AddSubdomains();
    services.AddMvc(x => x.EnableEndpointRouting = false);
}

You configure your routes just like standard routes, but you cannot use standard MapRoute methods. That will be explained later in wiki. Use MapRoute method from this lib extensions method which accepts hostnames as a parameter.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    var hostnames = new[] { "localhost:54575" };
    
    app.UseMvc(routes =>
    {
        routes.MapRoute(
            hostnames,
            "NormalRoute",
            "{action}",
            new { controller = "SomeController" });

        routes.MapSubdomainRoute(
            hostnames,
            "SubdomainRoute",
            "{controller}", //that's subdomain parameter, it can be anything
            "{action}",
            new { controller = "Home", action = "Action1" });
    )};
}

Usage

Your .cshtml files

Goal of that library is not only catching routes for subdomain but also generating links to actions while persisting standard razor syntax. Helper below will generate url <a href="http://home.localhost:54575">Hyperlink example</a>. Route named SubdomainRoute should catch that link.

@Html.ActionLink("Hyperlink example", "Action1", "Home")

Controller

Big advantage of library is you can catch all route values with controller.

//HomeController.cs
public IActionResult Action1()
{
    //code
}

Having url http://home.localhost:54575/ will invoke Action1 method in Home controller.

Running samples project

https://github.com/mariuszkerl/AspNetCoreSubdomain/wiki/Running-samples-project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].