Here is what I have.
1. A base controller marked mustinherit
2. The base controller in turn inherits from System.Web.Mvc.Controller
3. I have a child controller which is derviced from the Base Controller
4. The child controller has both a parameterless constructor and a contrustor that accepts two arguements.
Here is what I would like to do.
1. I have added a ViewData("Stylesheet") to the master page of the site I am working with
2. I plan to swap out CSS stylesheets based on the users browser (using Request.Browser.Browser)
3. I would like to add set the ViewData in the base class contructor so that all contructors will know where to get the data from for the user.
1. Have done this on the Base Controller
Public Sub New()
ViewData("Stylesheet") = BrowserStylesheet()
Private Function BrowserStylesheet() As String
Dim message As String = Nothing
Select Case Request.Browser.Browser
message = "<link href='../../Content/CSS/IE.css' rel='stylesheet' type='text/css' />"
message = "<link href='../../Content/CSS/Mozilla.css' rel='stylesheet
View Complete Post