c# - Automatically binding to custom domains in IIS 7.5 from .NET Web Application (MVC 3) -
i building web application in there core library , database shared many instances. give more concrete example lets have blogging engine , users can sign own blog act independently of others on system.
each instance must have own subdomain eg: http://john.extremeblogging.tld/ , have option have own domain mapped eg: http://jonnyblogger.tld/
the problem have not knowing how notify iis 7.5 when requests come in either of domains. simple setting web application default site within iis , application can use request headers take appropriate action?
it strikes me should pretty common task don't anticipate difficult solve @ moment not sure how approach it.
any guidance appreciated.
thanks
id
its been long question asked, still answering might helpful others in need.
i happened work on big saas based multi-tenant project involved unique subdomains each of users site. user design , manage content on own site.
on registration of tenant/user can add domain binding iis using c# following link-
http://amitpatelit.com/2013/03/12/enter-iis-binding-entry-by-c-code/
alongside need check host name request headers , subdomain name fetch subdomain specific data , interface etc.
protected override void onauthorization(authorizationcontext filter_context) { var url = request.headers["host"]; var index = url.indexof("."); if(index > 0) { var sub = url.split('.')[0]; frontsitedata = commonservice.getsitedata(sub); } }
please let me know if require more information.
regards,
manik
Comments
Post a Comment