0

I'm working on ASP.NET project that is written using WebForms. We are in a process of switching to MVC so we writing all new pages in MVC. There are some big parts of application that we don't want to rewrite just yet, like authentication which is located in our BasePage. BasePage is inherited from every WebForm page.

Question: Can an MVC View inherit from this common BasePage that is also used by WebForms? If Views can, would the BasePage run through it's normal page life cycle?

1 Answer 1

1

The short answer is not really.

Although MVC pages look and smell like webforms, they're different beasts. They use a new class called viewpage which inherits from page for starters.

Also in the MVC way of doing things, the view is too late to be doing things like security.

It would be better to spend time first converting your shared resources into service classes that you can re-use between webforms and MVC.

Simon

Sign up to request clarification or add additional context in comments.

2 Comments

good point. was just wondering if anyone has done such a thing and how it went for them.
I have a mix of MVC & webform apps that I support on our intranet. Our new development is all MVC. For older apps, we've moved to Model-View-Presenter when we do any updates, which is quite a good half-way house. It's still a webforms app, but with more of Model-View way of thinking. It should make it easier to transition from there to MVC at some later point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.