if i wanted to add common functionality to all pages i create a BasePage and drive all ASPX pages from it, how can you do that to Pageviews and Controllers in MVC ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For the Views (“Pageviews” as you call them) you probably won’t have too much data / behaviour to group in a base class but you still can. You would define a class that inherits from System.Web.UI.Page and place all the common logic there.
Then in your code behind files for the views (in ASP.NET MVC 1.0 there is no code behind file BY DEFAULT for the view but you can create it) inherit the view class from this common class.
For the controller you can create a class that inehrits from System.Web.Mvc.Controller and put all the common things in it. Then derive all your controller classes from this class. There’s no restrictions on namings, namespaces and file location.