Multicliente (multi-tenant) application with Asp.net webforms and routes

Asked

Viewed 172 times

3

I am developing a multi-client web application for a Saas and I would like each client to have a different URL to access their area in the application, for example:

http://meudominio.com/cliente1 http://meudominio.com/cliente2

I thought about creating in IIS an application for each client, but this in addition to costly can degrade the performance of the webserver (I believe).

Is there any way to do this using routes?

1 answer

1

You need to change your route:

routes.MapRoute(
    name: "Default",
    url: "{cliente}/{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

And retrieve the value in the controller

public ActionResult Index(string cliente)
{
    return View(cliente);
}
  • Does this work in webforms? I’ve tried this type of route but in webforms you have to define which page the route serves.. I can’t get a "default" route like that.

  • http://www.codeproject.com/Tips/698666/USE-OF-MapPageRoute-Method-IN-ASP-NET-WEBFORM-ROUT

Browser other questions tagged

You are not signed in. Login or sign up in order to post.