[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2029
  • Last Modified:

Parser Error Message: Could not load type '_Default'.

Hi Experts,

I'm running Visual Studio 2008. I am creating a Web project that has 2 .aspx pages. I just started getting this error message. It started occurring after one of the following events:

1. I converted my Web project to a Web application to expose the .aspx.designer.vb pages.
2. I renamed one of my .aspx pages top default.aspx because I was told that this was how the system would know which .aspx page to run first.

Anyway, now whenever I try to run the web page in debug mode, I get the message posted in my title. I have Googled the problem and looked at the posts for similar problems on this site. I have built, revbuilt and cleaned my site, but nothing seems to clear up the problem.  

Any suggestions would be greatly appreciated.

Thanks,

taduh


 
0
taduh
Asked:
taduh
  • 10
  • 10
1 Solution
 
burakiewiczCommented:
you wouldnt need to rename to default  all you have to do to set the startpage is right click on the file you want to be first and then click set as start page.  this can also be setup in iis where you deploy the site
0
 
wht1986Commented:
2 things i can think of.  
1) When you renamed the file, i assume you made sure the class references were updated as well
e.g.
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" Title="" %>
public partial class _Default : System.Web.UI.Page

and also

2) If this is an IIS application, make sure the version of .net is set correctly in the IIS manager. I've seen that error when the IIS is still set to .net 1.1

side note, if the app works with whatever the old default page was called (lets call it WebForm1.aspx), you can make the default document of the application any page you want by setting it in the IIS Manager

example here for IIS 6
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/dc6eb1b4-9028-4308-9935-52b64edfad36.mspx?mfr=true
0
 
taduhFinancial Systems AnalystAuthor Commented:
I changed the pagename in both places. In fact, I changed it back to the original name and ran into the same problem.

What is an IIS app (newbie here) and how do I invoke the IIS manager?
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
taduhFinancial Systems AnalystAuthor Commented:
What is this error telling me? I've tried everything short of rebuilding the site to remedy it - to no avail.
0
 
wht1986Commented:
right click "My Computer" and select "Manage", you will find a section on IIS. What you see varies a bit between systems.

http://msdn.microsoft.com/en-us/library/bb763170.aspx

Once you open it, you can set what version of .net an application uses.  This also varies by system, I can point you to a link if you tell me what OS you are running under.
0
 
taduhFinancial Systems AnalystAuthor Commented:
Windows XP Pro
0
 
wht1986Commented:
Let me rewind a second. I assume that when you renamed your page you did so in the visual studio environment and rebuilt (compiled) the web site.  Is that correct? If so, did the web site run in the debugger (F5) ok?
0
 
wht1986Commented:
to set default document in IIS 6
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/dc6eb1b4-9028-4308-9935-52b64edfad36.mspx?mfr=true

you can see the various tabs on a IIS web site here
http://www.beansoftware.com/ASP.NET-Tutorials/Set-Up-IIS-ASP.NET.aspx
The asp.net tab helps config which version you want running
0
 
taduhFinancial Systems AnalystAuthor Commented:
Yes, I renamed the page in the Visual Studio environment, then rebuilt the web site. But I keep encountering this error in the debugger.
0
 
taduhFinancial Systems AnalystAuthor Commented:
wht1986,

What do you suggest I check to try and first remedy this problem so that I don't encounter the error in the debugger. I've changed the page back to its original name, SelectionPg,aspx, but the .aspx page
first line contains the phrase, Inherits="_Default". the .aspx.designer.vb contains a line, Partial Public Class _Default and the .aspx.vb contains Partial Class _Default    Inherits System.Web.UI.Page. Still, when I run via the debugger, I get the Parser Error Message: Could not load type '_Default' error message?
0
 
wht1986Commented:
i would rename all the values back to SelectionPg for now, including the inherits declaration and the class file.  Then right click the file in the solution and click set as start up on SelectionPg.aspx.  For my own curiosity is this an IIS based project or a File System project?  I.e. when you run  the debugger does it run as http://localhost/yourprojectname or something like http://localhost:12345/yourprojectname
0
 
taduhFinancial Systems AnalystAuthor Commented:
When it runs it runs like  http://localhost:12345/yourprojectname.

What ar eyou referring to when you say the class file?
0
 
wht1986Commented:
Ok you are running as a file system project then and using the built in visual studio web server and not IIS.  Since you only have 2 page at this point, the fastest thing to do would be just to create a new Web App Project and create to empty aspx pages with the names you want to use.  Then just copy and paste the html markup and code behind methods for each.  If you want, you can zip your existing project and email it to me at wht1986@bellsouth.net.
0
 
taduhFinancial Systems AnalystAuthor Commented:
Still getting the same error..................
0
 
wht1986Commented:
Hmm, if you create a brand new web app project and without doing anything else, can you hit hit f5 and run the default created project?
0
 
taduhFinancial Systems AnalystAuthor Commented:
Yep.
0
 
wht1986Commented:
Here is an empty .net 3.5 web app project I just created in VS 2008.  Download and unzip it. You should be able to double click the solution and hit f5 to run the project with no issues.

http://www.kevinwhite.net/WebApplication1.zip
0
 
wht1986Commented:
Can you email me your 2 files or add the extension ".txt" to the back of them and post them here.
0
 
taduhFinancial Systems AnalystAuthor Commented:
Here they are.
SPaspx.txt
SPcodebehind.txt
0
 
wht1986Commented:
ok download my project at http://www.kevinwhite.net/WebApplication1.zip

The code works.  To make sure I even created a database with tables, and views so that your exact sql syntax would work against it.

All you have to do is change the connection string in the web config and it should work.
0
 
taduhFinancial Systems AnalystAuthor Commented:
wht1986,

I couldn't use your stuff since it was all in C#, but I took your suggestion from a few posts ago and built a new application from scratch then pasted everything from my old app in except for the @Page directive. I let it create that itself as I pasted everything in, so that got m epast the current error.
So I'm going to give you the points for solving this one.

Now I've got another problem, but I'm going to post that on a separate post.

Thanks for your help.

taduh
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 10
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now