c# 4.0 - Replacement for ASP.NET Virtual Directory for Multi-tenancy -


i working on asp.net webforms application, using asp.net 4.5

the application has multi-tenancy support. each tenant has own url like:

http://myapplication.net/demotenant1/

very simplified in login.aspx application calls method , translates url internal id.

 public static string gettenant(httprequest request) {     return = request.url.tostring();        } 

the problem now, have more 200 tenants, each need define webapplication is

  • a bunch of work :-)
  • probably inefficient own worker process each tenant opend

i looking smart replacement stay compatible old urls.

i looking idea how solve via url routing or maybe mix webforms mvc , add login controller?

also open other ideas...

i agree alexander said, proper way url routing. but... if trying save time...

first, remove of web applications;

so rid of...

http://myapplication.net/demotenant1/ http://myapplication.net/demotenant2/ http://myapplication.net/demotenant3/ 

and need make sure typing in following:

http://myapplication.net/ 

... takes actual webapplication want use.

then, in global.asax file... need capture 404 exceptions.

so when types in:

http://myapplication.net/demotenant1/ 

... throw 404 exception catch in global.asax file this:

void application_error(object sender, eventargs e) {     string urldata = request.servervariables["script_name"];      // string splitting demotenant1 value     // response.redirect("~login.aspx?tenant=demotenant1"); } 

its bit messy have done in past when in same situation you. although, have routing module built microsoft (which did not have @ time). quite sure can use routing modules within webforms, without having use mvc.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -