VS2010 web app could not load type 'usercontrol'

Posted on 2012-09-05
Last Modified: 2012-09-10

I have a VB.Net 2.0 (created in VS2003 and migrated to VS2005) web app which has been working with no issue. When I moved the code to VS2010, it complied. But as I run the app, it gives me the error 'Could not load type "MyNS.MyNS.MyType"'
<%@ Application Language="VB" CodeBehind="Global.asax.vb" Inherits="MyNS.MyNS.MyType" %>

Open in new window


Anyone has idea what causes this and how to fix this?

Question by:KingstonDeveloper
    LVL 7

    Expert Comment

    have you tried changing Inherits to MyNS.Global_asax?  At least it should match the public class name i believe.

    Author Comment

    Thanks Padre for your reply. This application was created in earlier version of VS and .Net so it doesn't have Site.Master page. What I did in VS2010 was create new empty web application, then add all the files and folders from the old project. It compiled successfully. The Public Class in the Global.asax.vb file is as followed:

    Imports System.Web
    Imports System.Web.Security
    Namespace MyNS
        Public Class MyType
            Inherits System.Web.HttpApplication
            Sub Application_Start(...)
            End Sub
        End Class
    End Namespace

    Open in new window


    Accepted Solution

    Okay, I finally have to recreate new Asp.Net App.
    Then, manually copied the code from the old Global.asax.vb file and pasted it in the new Global.asax.vb file. Renamed the Inherits="Global_asax" to my public class in Global.asax.vb file and Wah.Lah.  The problem went away.

    Author Closing Comment

    I solved this myself

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    This video discusses moving either the default database or any database to a new volume.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now