html - Different login page for every client (on one server) -
scenario: currently, have website tool in asp.net mvc
(www.tool.com/login)
. now, client looking customizing login page several customers , have own domain (but 1 server all).
for example:
www.client1.com/login
,
www.client2.com/login
,
www.client3.com/login
yell @ me if stupid question. please , give me idea on how implement it. should create different login htmls each client?
related comment -
create table clientinfo
in db:
- title
- backgroundcolor
- language
- url --> has unique work [client1, client2]. don't save full url -- host
let's passing model --> loginmodel
loginpage.cshtml
public class loginmodel { public string username { get; set; } public string password { get; set; } public styledto clientstyles { get; set; } } public class styledto { public string title { get; set; } public string logopath { get; set; } public string backgroundcolor { get; set; } }
in controller when load view:
public actionresult login() { var clienturl = httpcontext.current.request.url.host; var cs = dbcontext.clientinfo.first(s => s.url == clienturl); var model = new loginmodel() { clientstyles = new styledto() { title = cs.title, logopath = cs.logopath, backgroundcolor = cs.backgroundcolor } }; }
then in login view (loginpage.cshtml):
@model loginmodel <div style="background-color: @model.backgroundcolor"> <h1>@model.title</h1> </div>
Comments
Post a Comment