I need to add an ASP.NET web form pages to my ASP.NET API project. This is a legacy app that I don't have time to port over to the API & Angular just yet. The legacy page contains several controls including text boxes, drop down lists and a GridView control. All the code logic for the web form is contained in the code-behind page.
The problem I am running into is that when I try and rebuild the project the controls in the legacy web form are not recognized. I get the following error
Error CS0103 The name '<name of web control>' does not exist in the current context MyWebApp C:\source_code\MyWebApp\api\services\LegacyWebForm.aspx.cs
I get one of these errors for all the server side controls on the ASPX page.
I was pretty sure I could run this legacy web form inside of the API application and all I needed to do was add ...
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
My code behind file LegacyWebForm.aspx.cs
inherits from System.Web.UI.Page
and the ASPX page inherits the page class
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LegacyWebForm.aspx.cs" Inherits="MyWebApp.api.services.LegacyWebForm" %>
code-behind class name
namespace MyWebApp.api.services
{
public partial class LegacyWebForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
...