[Updated] Why & When should I port asp.net webforms solution to .net core, and are there any guides for that? RRS feed

  • Question

  • User-431595932 posted

    [Updated] Why & When should I port asp.net webforms solution to .net core, and are there any guides for that?

    Tuesday, May 26, 2020 11:07 AM

All replies

  • User475983607 posted

    When should I port asp.net webforms solution to .net core, and are there any guides for that?

    Migration guidance can be found in the official documentation.


    ASP.NET Core is very different approach to generating dynamic HTML than ASP.NET WebForms.  This will be a rewrite. 

    I recommend going through a few tutorials and reading the ASP.NET Core fundamentals docs.



    Working with data


    Tuesday, May 26, 2020 11:28 AM
  • User1535942433 posted

    Hi imagetech,

    Accroding to your description,as far as I think,ASP.NET Core does not support web forms so there isn't any way to just automatically convert an a Web Forms to an ASP.NET Core.

    However,it is possible to make the migration. The general architecture of ASP.NET Core is based on MVC so it's much more similar to ASP.NET MVC than ASP.NET Web Forms. So you could end up rewriting pretty much all of your UI code using some derivative of a MVC pattern. You could use  layouts. Instead of server controls you could use tag helpers. Instead of user controls you could use  partials and view components. Instead of code behinds you could use controllers and view models. Etc.

    It's worth noting that there is still an http context object, request object and response object and they are extremely similar to the analogous objects in web forms. So that helps with the conversion.

    Also to make the conversion process easier, you can build an ASP.NET Core web application that targets the full framework. This means that you will have access to most everything you are use to in the full framework except anything in the System.Web namespace. Targeting the Full framework does mean that your new website will only run on windows. But if you can live with that (at least for now) it will make the conversion process easier for you.

    If, in your old website, you broke out a bunch of the functionality into class libraries, that will make your life easier. You should be able to bring those class libraries over to the new website unchanged and reference them from the ASP.NET Core website and they will most likely work fine provided they don't reference System.Web. Any code that does reference System.Web will need to be modified to use the new analogous objects or UI approaches.

    So in the end, you may be able to bring over your data models, data access code, business objects, and business logic without too much hassle. But you will have to do a total rewrite of your UI related code. 

    Best regards,

    Yijing Sun

    Wednesday, May 27, 2020 2:08 AM
  • User-431595932 posted

    Thank you Yijing for your help. 

    Wednesday, May 27, 2020 8:12 AM
  • User1535942433 posted

    Hi imagetech,

    Could you have solved your problems?If you have solved,you could mark these answers which help you.

    Besides,if you have other questions,you could post to us.We are willing to help you.

    Best regards,

    Yijing Sun

    Thursday, May 28, 2020 1:28 AM
  • User409696431 posted

    No one answered the "when should I port a Web Forms site to .net core" portion of your question.

    The real question should be "why should you"?  Given that it will be a significant job that, presumably, someone will be paying for, the question of "why" should be answered.

    Is there a compelling reason you want to convert your existing site?

    Thursday, May 28, 2020 4:40 AM
  • User-821857111 posted

    Why & When should I port asp.net webforms solution to .net core

    There are lost of reasons why you might want to port from Web Forms to .NET Core. Pretty much all of them will come down to your own circumstances. Probably the most important thing to remember is that you don't have to migrate. Web Forms will continue to be supported for as long as the .NET Framework is supported, which, since it is a component of the Windows operating system, means that it shares the same support lifecycle as the OS on which it is installed.

    Thursday, May 28, 2020 9:20 AM