I have a problem how to reuse the webforms masterpage in mvc view. The project I am working on is an existing website where I have to change a single module to MVC. I have implemented successfully the routing logic but I am struggling with reusability of masterpages. I read this question here but it does not solve my problem because existing pages inherit from XClass
which by itself inherits from System.Web.UI.Page
. The same logic happens to be for mastepages. The reason is because the XClass
makes a lot of logic in background - like dealing with session values and validating user data etc etc. Is there any way how can I use those masterpages within view in MVC? I tried the solution given in question above but while debugging there is a statement XClass xpage = Page as XClass
in Page_Load
event which gives me the value null
and throws exception since in MVC we do not have Page_Load event etc... As I have read in other places they recommend to create a new masterpage for MVC but in my condition it would be very difficult. Any suggestion how to solve this problem ?
I am reading this article here but yet I am not clear how to implement it...
Here I have an image attached for masterpage in webforms.