aspx page running on Asp net mvc

Asked

Viewed 493 times

2

Good afternoon, I have an aspx page that, through some components, can generate several documents used in the company. Well, the page is in aspx and uses proprietary components (Dlls), I can not reverse engineer them, and as the site is in full migration to MVC now, I would like that, at least, run in aspx same. You can do something like this?

  • 1

    Favorite. I’ll write you a guide.

  • Your answer very much interests me @Gypsy

1 answer

3

This answer is expected to undergo a number of changes in the coming days, in line with the subsequent doubts of the questioner on specific aspects of its application. It may be that other questions can be opened or used to explain some more complex aspect. I will be reading the comments every day. Please mention me in the comments so I can improve the response by directing to your question.

I will go over some aspects in the answer. If necessary, I will add more over the days. The idea is to use these ideas as a roadmap for your migration.

1. When converting your project, you don’t need to use your Views in Razor

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 generation of Views through legacy pages. This can be easily seen when creating a new ASP.NET MVC4 project:

ASP.NET MVC Usando ASPX

2. MVC views do not have Code Behind, nor must they possess

This step is inevitable: it will be necessary to transfer any and all logic from your Code Behind for two possible places:

  • Controller
  • Eventos Javascript

3. Postback does not exist in MVC

Basically a Postback is a 3 part abstraction:

  • Some Javascript logic;
  • Some HTML code;
  • Some server-side behavior (Server-Side).

By the time AJAX Toolkit was designed, all this logic was too much to be done. Today we have a myriad of Javascript libraries that simplify work and allow the programmer to extend Javascript behavior beyond the possible in AJAX Toolkit, which has made it long and complex to maintain.

The classic Postback replacement can be done using, for example:

  • Jquery;
  • Razor or ASPX;
  • Events in Controller that return:
    • JSON;
    • Partial Views;

4. Your controllers must call the proprietary Dlls

Refer to your Dlls normally within the MVC project, as is done in the Classic ASP.NET project. Calls to each class and method are made in the same way.

  • Thanks for the reply, I will study it and if you have any questions I will post here, again thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.