asp.net.netasp.net-coreuser-controlsascx

Possibility of Consuming .Net User Control(.ascx) in ASP .Net Core Project


I need to render the .net user control(.ascx) in ASP .net core project. I can able to run the user control in MVC projects. Same way Can we consume user control ASP .Net Core or Can we add aspx page in asp.net core project?


Solution

  • Same way Can we consume user control ASP .Net Core or Can we add aspx page in asp.net core project?

    No, you can't use them in core projects, they are completely belong to different projects.

    First you need to understand the function of user controls in the .net project, and then you can find the corresponding method in the core project to replace it.

    User controls contain code which can be re-used. It can be used across application as per the requirement.

    There are two similar concepts in the core project: Partial view and View component.

    You can rewrite the logic in user control to partial view or view component.

    You can refer to these two official documents, and then try to use them to replace user controls in the core project.