could not load type "_Default"


  • Hi everybody :)

    I'm doing a web app for some university coursework, its the first time I've used ASP.NET C# and I'm loving it but when I put the files on the remote server I get the error on this page.


    Someone told that I need to copy a project or something and do it that way, I'm using the Visual Studio 2005 Beta 2 version and I can't find this function anywhere.  If anyone could help with that or give me another fix then I would be very grateful.

    Thank you for your time.


    p.s. this is my code but this still gives me the same error

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)



    And I am using the default generated statement at the top of each .aspx page.

    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    Tuesday, October 11, 2005 3:21 PM


  • this is an asp.net issue.

    You should post it on http://www.asp.net.
    Sunday, October 16, 2005 2:10 AM

All replies

  • Your code should be compiled in a DLL file that is called the Assembly. This assembly needs to be deployed with your project - namely it should be put in the bin directory just like it is in on your local host. This allows you to semi-protect your code and makes deploying alot easier.
    Tuesday, October 11, 2005 6:02 PM
  • how do I do that?? I'me very new to Visual Studion and ASP.NET.

    I have already (in VS 2005) gone to build >> publish htpp://.......

    That created a .dll and some other precompiled files in a bin folder but when I put these on my web server I get the same error still. (url - - http://www.apixelmind.com/bonjovi/)

    Am I going to the wrong function in VS?? if so can someone exaplin the menu and how it is accessed etc please.

    Thank you for your time.

    Tuesday, October 11, 2005 7:32 PM
  • this is an asp.net issue.

    You should post it on http://www.asp.net.
    Sunday, October 16, 2005 2:10 AM
  • I have found that I have to go into the offending *.vb file, make a small change (it doesn't matter what), and save the project.  This apparently resets something in the Visual Studio project.  Good luck.
    Thursday, October 20, 2005 4:44 PM
  • Has somebody solved this?

    I have a solution with 5 class libraries, and they work fine on my pc, I checkin to Visual Source Safe, the other developer download the solution, and when he tries to see a page, He gets that error


    Any idea

    Saturday, March 04, 2006 4:51 AM
  • I heard that when you didn't embed the source codes as script in c# or VB, a dll file  created by .net in source directory(c:\, d:\ ....etc) and same named with your project. So you must either checkin this dll if that isn't like this, you can add your source code as script between head tags.
    Wednesday, February 21, 2007 9:32 AM
  • I've been forced to do an aspx C# project and it looks like I've got the same problem you've reported.  In a similar version my aspx file with an expanded version of the C# code the same "could not load type "_Default" " does not occur.

    Obviously it is my fault because I did something wrong.  It could not possibly be the fact that the Microsoft product design crew intentionally created so many exceptions to rules so that they could generate maximum revenue by selling even more tools "to make it easier" on developers.  But, I do believe it is a fact that Microsoft designers have an inherent bias against the web because they want to give everything the option of being a Windows-like, if not a Windows, world.

    That being said, it looks like you do have an option, just go write your code in PHP.

    I on the other hand, still need to figure out this context problem where Microsoft could not possibly put themselves out and create either a completely non-Visual Studio or at least create a web context within Visual Studio.  (For example, "Request.QueryString["encryptedData"].ToString()" is out of context since Microsoft decided not to make provisions to simulate the query string as input.)

    Good Luck to you.  I hope you found / find your answer.
    Wednesday, October 17, 2007 3:18 PM



    This is problem with multiple versions of framework installed on the machine.


    To rectify this go to IIS manager and right click on Default Web Site and go to properties. In the property window go to ASP.Net tab and There select the ASP.Net Version as 2.0....... instead of 1.1..... Then go to Documents tab and add 'Default.aspx' document if it is not there in the list. and select the virtual directories to which you want to apply this rule for.


    Then you should be able to eliminate this error.


    Have a nice programing time. Bye

    Tuesday, October 23, 2007 5:06 PM
  • I simply created a folder with the name "bin" in the IIS virtual directory for my site, and then dropped the dll in said folder.. problem solved, hope this helps.

    Sunday, November 09, 2008 4:16 AM
  • Tx RenjithG , This helped me.
    Saturday, February 06, 2010 7:31 AM
  • I am experiencing the same problem, but in my case, it wasnt related to IIS or the version of the .net framework. I have a solution that has been working for many days, and the problem just started. In Solution Explorer, I right click on the Default.aspx, and select "view in browser". The resulting message is "Parser error - Could not load type '_Default'.

    For test purposes, I created a new soultion with a website in it, right clicked on Default.aspx, selected "view in browser", and it works fine. The code in both Default.aspx pages is identical. Both were created using the .Net framework 3.5. The one I have been working with displays the error. The new one does not. Default.aspx.designer.vb files were also identical.

    Here's what the problem was...
    In the solution that wasnt working, the code in default.aspx.vb was oddly marked "Public Partial Class _Default1", whereas the one that worked was "Partial Class _Default". To add to the oddity, there were no dividing lines between the "inherits System.web.ui.page" line and the Protected Sub Page_Load line, which suggested that VS2008 was having trouble understanding how to display the code in the file. I closed the solution and reopened, which solved the problem studio was having with displaying the code in the default.aspx.vb file. I then updated the first line of code in the Default.aspx file to include "Inherits="ProjectName._Default", where "_Default" is the same as the class name in default.aspx.vb. Rebuilt, no more problems.

    Tuesday, March 09, 2010 7:30 PM
  • Please read the announcements at the top of this forum to see where to post ASP.NET and IIS questions and problems.

    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
    Tuesday, March 09, 2010 9:41 PM