0

So I need to develop a web form to get data from the scanner. But I encounter a problem stating that " "is not allowed here because it does not extend class 'System.Web.UI.Page'. As I'm aware that this topic is already been discussed, I still not able to solve it.

I have tried this steps but none of this working..

  1. Webform not allowed because it does not extend Class

  2. Parser Error: '_Default' is not allowed here because it does not extend class 'System.Web.UI.Page' & MasterType declaration

  3. Webform not allowed because it does not extend Class

and already skim thorugh this https://weblog.west-wind.com/posts/2005/Sep/12/Understanding-Page-Inheritance-in-ASPNET-20 to understand more about the inheritance.

this is the lalala.aspx file

<%@ Page Language="C" AutoEventWireup="true" CodeBehind="lalala.aspx.cs" Inherits="TEST.lalala" %>

this is the lalala.aspx.cs file

namespace TEST
{
public partial class lalala : Form
{
// 
}
}

I really think that this error is cause by the page inheritance but I don't know how to fix it.. Please someone guide me

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
  • 1
    `public partial class lalala : Form` - What is the `Form` class? Does it inherit or extend `System.Web.UI.Page`? if not that is your problem. – Jon P Oct 31 '19 at 05:40
  • Possible duplicate of [Error - class does not extend System.Web.UI.Page](https://stackoverflow.com/questions/17552211/error-class-does-not-extend-system-web-ui-page) – Stephen Kennedy Oct 31 '19 at 18:22

1 Answers1

1

Try this (presuming you are not using a master page):

namespace TEST
{
    public partial class lalala : System.Web.UI.Page
    {

    }
}
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
  • 1
    Yep-- even though it is called "Web Forms," the base class for all pages/forms is [`Page`](https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.page?view=netframework-4.8). – John Wu Oct 31 '19 at 07:03