0

So I'm trying to make an "About" page that can be shared across many web applications that we use. To do this, I'm going to be saving the "AboutBox.aspx" and "AboutBox.aspx.vb" files on our web server. Then, from each application, I'll open a pop-up window that will call the AboutBox page by its url. The Problem I'm having is after I've created the page and copied it to the server, when I try to open the page it's giving me the error:

Parser Error Message: Could not load type 'DemoWebApp.AboutBox'.

Line 1:  <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AboutBox.aspx.vb" Inherits="DemoWebapp.AboutBox" %>

So I'm assuming it's having an issue with "Inherits" having the project name "DemoWebApp" in front of the class name.

Also, the code behind file that was created with the web form has "Public Class AboutBox" instead of what I think they're supposed to have which is "Partial Class AboutBox"

I've tried just getting rid of "DemoWebApp." from the inherits and also just changing the code behind to being a partial class instead of public. This didn't work.

Additionally, someone else created a test web form page from an older version of Visual Studio. This web form didn't have the project title in the inherits and had a partial class instead of public. This page was copied to the server and worked just fine.

I'm using Visual Studio 2013, I'm not sure if it's an issue with this version or something else entirely.

Is there any way that, when you add a new web form file to the project, it will create the file the way I need it to?

EDIT:

Here is my AboutBox.aspx code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AboutBox.aspx.vb" Inherits="TestAboutBox.AboutBox" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body style="height:238px; width:486px; background-color:green">
    <form id="form1" runat="server">
            <div style="width:154px; height:232px; float:left;">
                <asp:Image ID="LogoImage" runat="server" Height="232px" ImageAlign="Middle" Width="154px" ImageUrl="small.png"/>
            </div>
            <div style="width:326px; height:232px; float:right">
                <asp:Label ID="LabelProductName" runat="server" Text="Product Name" Font-Size="8.25pt" Font-Names="Microsoft Sans Serif" style="margin:5px"></asp:Label>
                <br />
                <asp:Label ID="LabelVersion" runat="server" Text="Version" Font-Size="8.25pt" Font-Names="Microsoft Sans Serif" style="margin:5px"></asp:Label>
                <br />
                <asp:Label ID="LabelCopyright" runat="server" Text="Copyright" Font-Size="8.25pt" Font-Names="Microsoft Sans Serif" style="margin:5px"></asp:Label>
                <br />
                <asp:Label ID="LabelCompanyName" runat="server" Text="Company Name" Font-Size="8.25pt" Font-Names="Microsoft Sans Serif" style="margin:5px"></asp:Label>
                <br />
                <asp:TextBox ID="TextBoxDescription" runat="server" Height="113px" Width="317px" Font-Size="8.25" Font-Names="Microsoft Sans Serif" TextMode="MultiLine" BackColor="#F0F0F0" style="margin:5px" ReadOnly="True">Description :</asp:TextBox>
                <input type="submit" name="OKButton" value="OK" onclick="window.close();" id="OKButton" style="height:21px;width:75px;float:right; margin:5px" />
            </div>
    </form>
</body>
</html>

Aaand here's my AboutBox.aspx.vb file:

Public Class AboutBox
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

End Class

NOTE: I re-made the project under the name "TestAboutBox" since "DemoWebApp" was getting all messed up with me screwing around with stuff.

wedsa5
  • 39
  • 8
  • How did you create the page? – mason Feb 13 '15 at 21:24
  • right clicking the project in the solution explorer, mousing over "Add", clicking "New Item..." and choosing "Web Form" then clicking the add button. – wedsa5 Feb 13 '15 at 21:32
  • And do you have any other type name of `AboutBox` in your application other than the page class itself? – mason Feb 13 '15 at 21:33
  • Nope. I made this application just to create this page and test it. – wedsa5 Feb 13 '15 at 21:35
  • Is this a *website*, or a *web application project*? Did you upload the designer files? And yes, your page class should be `protected partial`. – mason Feb 13 '15 at 21:37
  • It's a web application. the web form code behind files don't have protected partial, they are public class. EDIT: I didn't copy over the designer file. – wedsa5 Feb 13 '15 at 21:39
  • You must copy over the designer file. And your page class must be `protected partial`. Do that, and see if it resolves your issue. – mason Feb 13 '15 at 21:45
  • I copied over the designer file. It wouldn't allow me to change it to `Protected Partial Class AboutBox`, but it gave me the option to change it to `Partial Public Class AboutBox`. I tried that and it didn't work. I also tried just making it `Partial Class AboutBox` and that did not work either. – wedsa5 Feb 13 '15 at 21:53
  • Did you post your entire class? I don't see a namespace. – mason Feb 14 '15 at 01:44
  • That's everything. And it was automatically generated. – wedsa5 Feb 16 '15 at 13:02

1 Answers1

0

When you create a new Web Forms page from a Web Application project, it will create the page as described in the question. In order to get it the right way, the Web Form page needs to be made in a Web Site project. This page can then be used elsewhere.

wedsa5
  • 39
  • 8