I am trying to have 2 different themes (basically 2 different CSS). User has an option to choose either light or dark theme. If he chooses the light theme, I need to load the light themed CSS and if he chooses the dark theme, I need to load the dark themed CSS.
I tried this
.NET MVC: How to implement different page appearance per user?
but was not able to make it working because Url.Action
was just generating the link and it was not returning the result from the Action method.
I have a layout page which all the pages in my website inherits and I somehow want to have this to be loaded in the Layout page.
The other approach is http://forums.asp.net/t/1892421.aspx?Dynamic+Themes+in+MVC+Razor
Is it ok to set the css in HttpContext.Application["Theme"]
?
The other approach I came across was setting the css file using javascript while loading the page.
Which approach do you think is better?