locked
pages inherit from class that has a prefix - this causes me problems RRS feed

  • Question

  • User297437924 posted

    My asp.net pages have code-behind pages of type VB.  The code behind pages are classes.   So a sample page might look like this:

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="expt2.aspx.vb" Inherits="EchoRedoWeb.expt2" %>

    Notice that the page (expt.aspx) inherits a class named "EchoRedoWeb.expt2"

    When I look at the code-behind page, I see:

    Public Class expt2
        Inherits System.Web.UI.Page

    There is no prefix of 'EchoRedoWeb' for 'expt2'.   

    So why is this a problem?

    The reason this is  a problem is because I have an existing website that doesn't seem to need these prefixes.  It was made with an earlier version of Visual sSudio  - a couple of years ago, and in the above case there would be no prefix.  A declaration at the top of an asp.net page for the above would look like this instead: Inherits="expt2"

    To save money, I was going to put an entire demo website in a subfolder of the existing online website, and demonstrate to a person who might later pay for it.   So I ftp'ed my files over to a subfolder, and then I tried to access expt2.aspx.   It gave me an error that it  Could not load type 'EchoRedoWeb.expt2'.

    Is there a way to make my new project not require this 'EchoRedoWeb' prefix on its classes?

    Thanks

    Tuesday, March 3, 2020 7:24 PM

Answers

  • User475983607 posted

    There is no prefix of 'EchoRedoWeb' for 'expt2'.   

    So why is this a problem?

    EchoRedoWeb is the web application's namespace.  This was created when you initially created the web application project and named it EchoRedoWeb.

    The reason this is  a problem is because I have an existing website that doesn't seem to need these prefixes.

    The other application is most likely a web site project. 

    To save money, I was going to put an entire demo website in a subfolder of the existing online website, and demonstrate to a person who might later pay for it.   So I ftp'ed my files over to a subfolder, and then I tried to access expt2.aspx.   It gave me an error that it  Could not load type 'EchoRedoWeb.expt2'.

    You can't just copy a web site or web application to a folder.  You have to create a virtual directory or new application.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 3, 2020 9:05 PM
  • User-37275327 posted

    You can set src attribute

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="expt2.aspx.vb" Inherits="EchoRedoWeb.expt2" src="expt2.aspx.vb" %>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 5:43 AM

All replies

  • User475983607 posted

    There is no prefix of 'EchoRedoWeb' for 'expt2'.   

    So why is this a problem?

    EchoRedoWeb is the web application's namespace.  This was created when you initially created the web application project and named it EchoRedoWeb.

    The reason this is  a problem is because I have an existing website that doesn't seem to need these prefixes.

    The other application is most likely a web site project. 

    To save money, I was going to put an entire demo website in a subfolder of the existing online website, and demonstrate to a person who might later pay for it.   So I ftp'ed my files over to a subfolder, and then I tried to access expt2.aspx.   It gave me an error that it  Could not load type 'EchoRedoWeb.expt2'.

    You can't just copy a web site or web application to a folder.  You have to create a virtual directory or new application.  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 3, 2020 9:05 PM
  • User-37275327 posted

    You can set src attribute

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="expt2.aspx.vb" Inherits="EchoRedoWeb.expt2" src="expt2.aspx.vb" %>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 5:43 AM