Migration system.web.UI from .net 4.8 to .net core 8

Rahul vyas 0 Reputation points
2024-08-14T06:34:15.6166667+00:00

Hi Guys,

I am migrating a .NET 4.8 application to .NET Core 8, but my application uses System.Web.UI controls, which is causing errors during the migration. Could you please suggest how I can migrate System.Web.UI to .NET 8?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,573 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ping Ni-MSFT 4,335 Reputation points Microsoft Vendor
    2024-08-14T08:12:23.1566667+00:00

    Hi @Rahul vyas,

    For System.Web.UI controls, it seems you use ASP.NET Web Forms application and it applies for .NET Framework, instead of .Net Core. ASP.NET Web Forms are not supported in .NET Core or .NET 8.

    To achieve the similar behavior in .Net Core application, You could try to use ViewComponent or Partial View. Besides, you could also consider creating custom tag helper to render multiple html elements.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Rena

    0 comments No comments

  2. Bruce (SqlWork.com) 65,661 Reputation points
    2024-08-14T15:51:34.3566667+00:00

    System.Web.UI are the asp.net webform controls. in asp.net 4.8 MVC actions or views you could instantiate and call the render method. This library was not ported to .net core (net 8). You will need to find a replacement technology. here are some common replacements:

    razor components

    https://learn.microsoft.com/en-us/aspnet/core/blazor/components/integration?view=aspnetcore-8.0#use-non-routable-components-in-pages-or-views

    tag helpers:

    https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring?view=aspnetcore-8.0

    html helpers

    https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.viewfeatures.htmlhelper?view=aspnetcore-8.0

    note: a common webform component was SSRS control. this has not been ported to .net 8. google for workarounds or replacement commercial (paid) products

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.