?
Solved

ASP.Net (VB.Net) Compilation Error (Parser Error ) Unable to load type

Posted on 2012-08-31
4
Medium Priority
?
1,289 Views
Last Modified: 2013-11-19
Hello,

I recently uploaded an ASP.NET site to GoDaddy and wanted to test the website to ensure that everything looked ok.  Well things working just fine on my laptop but when I try an run the site on GoDaddy I receive the following error:

Parser Error Message: Could not load type 'CharWeb.CharSite'.

Source Error: 


Line 1:  <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="~/CharSite.Master.vb"  Inherits="CharWeb.CharSite" %>

 

Open in new window


All of the aspx files are located in the root directory as well as the master page.

What is causing this issue?  On my laptop the directory is CharWeb/CharWeb/ then the files but on Godaddy I only have the root directory (html) then the actual website files.

Here is the actual code for the masterpage CharSite.Master:

<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="CharSite.Master.vb"  Inherits="CharWeb.CharSite" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 785px;
        }
        .style2
        {
            width: 53px;
        }
        .style4
        {
            width: 88px;
        }
        .style5
        {
            width: 683px;
        }
        .style7
        {
            width: 175px;
        }
        .style8
        {
            width: 164px;
        }
        .style9
        {
            width: 130px;
        }
        .style10
        {
            width: 148px;
        }
        .style11
        {
            width: 176px;
        }
        .style12
        {
            width: 1003px;
        }
    </style>
    
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
    <div>
        <div id="header" >
            <table>
                <tr>
                    <td class="style2">
                    </td>
                    <td class="style12">
                    </td>
                    <td class="style1">
                        <asp:Image ID="CharLogoImg" runat="server" 
                            ImageUrl="~/Images/Char_Productions_blk.png" />
                    </td>
                    <td class="style5">
                    </td>
                </tr>
            </table>
        </div>
        <div id="menu">
            <table>
                <tr>
                    <td class="style11">
                    </td>
                    <td class="style7">
                        <asp:LinkButton ID="HomeLinkButton" runat="server" CssClass="linkButtonHover" 
                            PostBackUrl="~/Default.aspx" ForeColor="#EE9926">Home</asp:LinkButton>
                    </td>
                    <td class="style8">
                        <asp:LinkButton ID="AboutUsLinkButton" runat="server" CssClass="linkButton" 
                            PostBackUrl="~/about.aspx" ForeColor="#EE9926">About Us</asp:LinkButton>
                    </td>
                    <td class="style9">
                        <asp:LinkButton ID="EventsLinkButton" runat="server" CssClass="linkButton" 
                            PostBackUrl="~/charevents.aspx" ForeColor="#EE9926">Events</asp:LinkButton>
                    </td>
                    <td class="style10">
                        <asp:LinkButton ID="WeddingsLinkButton" runat="server" CssClass="linkButton" 
                            PostBackUrl="~/weddings.aspx" ForeColor="#EE9926">Weddings</asp:LinkButton>
                    </td>
                    <td class="style4">
                        <asp:LinkButton ID="ContactUsLinkButton" runat="server" CssClass="linkButton" 
                            PostBackUrl="~/contactus.aspx" ForeColor="#EE9926">Contact Us</asp:LinkButton>
                    </td>
                </tr>
            </table>
        </div>
        <div id="breadcrumbs">

        </div>
        <div id="content">
            <asp:ContentPlaceHolder ID="CPH1" runat="server">
                
                <br />
                
            </asp:ContentPlaceHolder>
        </div>
    </div>
    </form>
</body>
</html>

Open in new window


The CharSite.Designer file:

'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated. 
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict On
Option Explicit On


Partial Public Class CharSite

    '''<summary>
    '''form1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents form1 As Global.System.Web.UI.HtmlControls.HtmlForm

    '''<summary>
    '''SiteMapDataSource1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents SiteMapDataSource1 As Global.System.Web.UI.WebControls.SiteMapDataSource

    '''<summary>
    '''CharLogoImg control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CharLogoImg As Global.System.Web.UI.WebControls.Image

    '''<summary>
    '''HomeLinkButton control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents HomeLinkButton As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''AboutUsLinkButton control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents AboutUsLinkButton As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''EventsLinkButton control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents EventsLinkButton As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''WeddingsLinkButton control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents WeddingsLinkButton As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''ContactUsLinkButton control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents ContactUsLinkButton As Global.System.Web.UI.WebControls.LinkButton

    '''<summary>
    '''CPH1 control.
    '''</summary>
    '''<remarks>
    '''Auto-generated field.
    '''To modify move field declaration from designer file to code-behind file.
    '''</remarks>
    Protected WithEvents CPH1 As Global.System.Web.UI.WebControls.ContentPlaceHolder
End Class

Open in new window


And the CharSite.Master.vb CodeBehind:
Public Class CharSite
    Inherits System.Web.UI.MasterPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        HomeLinkButton.ForeColor = Drawing.Color.Red
    End Sub


    Protected Sub HomeLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles HomeLinkButton.Click
        If HomeLinkButton.CssClass = ".linkButton" Then
            HomeLinkButton.CssClass = ".linkButtonHover"
            WeddingsLinkButton.CssClass = ".linkButton"
            EventsLinkButton.CssClass = ".linkButton"
            ContactUsLinkButton.CssClass = ".linkButton"
            AboutUsLinkButton.CssClass = ".linkButton"
        Else
            HomeLinkButton.CssClass = ".linkButton"
        End If

    End Sub

    Protected Sub AboutUsLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles AboutUsLinkButton.Click
        If AboutUsLinkButton.CssClass = ".linkButton" Then
            AboutUsLinkButton.CssClass = ".linkButtonHover"
            WeddingsLinkButton.CssClass = ".linkButton"
            EventsLinkButton.CssClass = ".linkButton"
            ContactUsLinkButton.CssClass = ".linkButton"
            HomeLinkButton.CssClass = ".linkButton"
        Else
            AboutUsLinkButton.CssClass = ".linkButton"
        End If
    End Sub

    Protected Sub EventsLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles EventsLinkButton.Click
        If EventsLinkButton.CssClass = ".linkButton" Then
            EventsLinkButton.CssClass = ".linkButtonHover"
            WeddingsLinkButton.CssClass = ".linkButton"
            HomeLinkButton.CssClass = ".linkButton"
            ContactUsLinkButton.CssClass = ".linkButton"
            AboutUsLinkButton.CssClass = ".linkButton"
        Else
            EventsLinkButton.CssClass = ".linkButton"
        End If
    End Sub

    Protected Sub WeddingsLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles WeddingsLinkButton.Click
        If WeddingsLinkButton.CssClass = ".linkButton" Then
            Weddingslinkbutton.CssClass = ".linkButtonHover"
            HomeLinkButton.CssClass = ".linkButton"
            EventsLinkButton.CssClass = ".linkButton"
            ContactUsLinkButton.CssClass = ".linkButton"
            AboutUsLinkButton.CssClass = ".linkButton"
        Else
            WeddingsLinkButton.CssClass = ".linkButton"
        End If
    End Sub

    Protected Sub ContactUsLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ContactUsLinkButton.Click
        If ContactUsLinkButton.CssClass = ".linkButton" Then
            ContactusLinkButton.CssClass = ".linkButtonHover"
            WeddingsLinkButton.CssClass = ".linkButton"
            EventsLinkButton.CssClass = ".linkButton"
            HomeLinkButton.CssClass = ".linkButton"
            AboutUsLinkButton.CssClass = ".linkButton"
        Else
            ContactUsLinkButton.CssClass = ".linkButton"
        End If
    End Sub
End Class

Open in new window

0
Comment
Question by:Magiccity33
  • 2
  • 2
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38353403
>Inherits="CharWeb.CharSite"

You are missing the namespace. Either add the namespace charweb in your charsite class or change the above to

Inherits="CharSite"
0
 

Author Comment

by:Magiccity33
ID: 38362178
Went into the Charsite class and in the codebehind added the imports CharWeb namespace but I am still receiving the error on goDaddy.  Again everything runs on my laptop but not on their servers.  Also tried removing CharWeb from the inherits statement, but that did not work either.  This is weird as I did both of those before submitting to experts-exchange for assistance.  What else could possibly be wrong?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 38365226
>in the codebehind added the imports CharWeb namespace

I meant adding

namespace CharWeb

not imports.

Site is not precompiled is it?
0
 

Author Closing Comment

by:Magiccity33
ID: 38369700
After doing more research I decided to not only take the suggestion of CodeCruiser but also changed CodeBehind to CodeFile in the page directive and everything works now.

Thanks for the quick response
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question