Page in aspx running on asp net mvc

2

Good afternoon, I have a page in aspx that, through some components, can generate several documents used in the company. Well, the page is in aspx and it uses proprietary components (DLLs), so I can not reverse engineer them, and since the site is fully migrated to MVC now, I'd like it to at least run in aspx itself. Can you do something like this?

    
asked by anonymous 27.07.2014 / 22:18

1 answer

3
  

This response should undergo a number of changes over the next few days, depending on the questioner's subsequent doubts about specific aspects of his application. It may be that other issues can be opened up or used to make something more complex. I'll be reading the comments every day. Please let me know in the comments so that I can improve the answer by directing you to your question.

I'll go into some detail in the answer. If necessary, I will add more in the course of days. The idea is to use these ideas as a roadmap for your migration.

1. When converting your project, you do not need to use your Razor Views

First of all, it is important to say that migrating an ASP.NET application to ASP.NET MVC does not necessarily mean that the Razor engine will be used to generate the Views . MVC supports Views generation through legacy pages. This can easily be seen when creating a new ASP.NET MVC4 project:

2. Views in MVC do not have Code Behind , nor should they have

This step is inevitable: you will need to transfer any logic from your Code Behind to two possible places:

  • Controller
  • JavaScript Events

3. Postback does not exist in MVC

Basically a Postback is an abstraction of 3 parts:

  • Some JavaScript logic;
  • Some HTML code;
  • Some server-side behavior.

At the time the AJAX Toolkit was designed, all of this logic was too laborious to do. Nowadays we have a myriad of JavaScript libraries that simplify the work and allow the programmer to extend JavaScript behavior beyond the AJAX Toolkit, which has made it long-winded and complex to maintain.

Classic postback substitution can be done using, for example:

  • JQuery;
  • Razor or ASPX;
  • Controller events that return:
    • JSON;
    • Partial Views;

4. Your Controllers should call the proprietary DLLs

Refer to your DLLs normally within the MVC project, just like in the Classic ASP.NET project. Calls to each class and method are made in the same way.

    
28.07.2014 / 03:20