开发者

Will there be any problem if i inherit aspx page from System.Web.Mvc.ViewPage

开发者 https://www.devze.com 2022-12-28 12:28 出处:网络
I am developing a website which will be having both 开发者_StackOverflow中文版asp.net pages and MVC pages in it, So I have BaseWebPage class which will be used for both asp.net pages and MVC Views. bu

I am developing a website which will be having both 开发者_StackOverflow中文版asp.net pages and MVC pages in it, So I have BaseWebPage class which will be used for both asp.net pages and MVC Views. but My BaseWebPage class is inherited from System.Web.Mvc.ViewPage, So Will there be any code/ functionality break for normal asp.net pages, because System.Web.Mvc.ViewPage is overriding some of the Pagelife cycle methods.


There could be. What you're proposing to do will probably work in MVC 2, but it's unsupported and may break in MVC 3 or any other future version.

What you may want to do instead is factor the common logic into a property or other item that is accessible both from your WebForms pages and your MVC views but which is distinct from the pages / views themselves. That way, changes in the pipeline are less likely to affect these parts of your application.

0

精彩评论

暂无评论...
验证码 换一张
取 消