0

I am working on a project with another developer using C#, .NET 3.5. We have come across a problem where the code works on my machine, but when it is ran on his we get the following error:

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

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

The actual header from Default.aspx looks as follows:

<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="<myApplication>._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

We have tried the following so far:

  • Undoing any changes he had made so he had the last server version
  • Clearing browser cache
  • Resetting IIS

When that didn't work we even went so far as to remove his version of the website from his local machine and reload it directly from TFS. That didn't work either...

This problem only happened late yesterday afternoon - prior to that it was working correctly. He had made some changes but nothing that should have caused this and especially considering he has the latest version from TFS (which works on my machine) then I can't understand how it isn't working.

One other thing is that if we publish it to the website from his machine then it works, so it certainly suggests an issue at his end, but I am at a loss as to what it could be.

Community
  • 1
  • 1
Andrew
  • 2,315
  • 3
  • 27
  • 42
  • have you try with ` CodeFile="Default.aspx.cs" ` instead of `CodeBehind="Default.aspx.cs"`? – Damith Aug 30 '13 at 08:21
  • `` is not a valid namespace identifier, it has to be the name of the namespace in your codebehind file, where the `class _Default : Page` resides – metadings Aug 30 '13 at 08:28
  • Hi sorry, is just a placeholder I used for this post - the real file has the project name in, but my company doesn't allow us to put real project names when asking these types of questions :) – Andrew Aug 30 '13 at 08:29
  • check your `Default.aspx.cs`, there is something like `namespace myApplication { class _Default : Page { /**/ } }` and these identifiers you need to concat like `myApplication._Default` - if you don't have a namespace, use one, or ASP.NET defaults it to `ASP` - and you can also try to cleanup the `\Windows\Microsoft.NET\Framework\v4...\Temporary ASP.NET Files` folder - none of the versions I know does this automatically or reliable – metadings Aug 30 '13 at 08:35
  • possible duplicate of [Could not load type 'site.\_Default'](http://stackoverflow.com/questions/2394003/could-not-load-type-site-default) see also [CodeFile vs CodeBehind](http://stackoverflow.com/questions/73022/codefile-vs-codebehind) – metadings Aug 30 '13 at 08:40
  • Yeah, I did see that page earlier and tried the things on them but nothing worked. What confuses me is that I am on a machine with the exact same configuration, the exact same code etc and it works on mine but not his.... – Andrew Aug 30 '13 at 08:43
  • use this line and try <%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> – Vinay Pratap Singh Bhadauria Aug 30 '13 at 08:46

1 Answers1

0

Many thanks for your responses - its fixed now and it was a really stupid thing. Basically in the solution we have another website, which forms another part of our solution. For some reason the options file or whatever had defaulted to this project and reset the start page. This project doesn't have a default.aspx page, hence the error. I simply reset the start page and changed the startup project and it worked!

Thanks

Andrew

Andrew
  • 2,315
  • 3
  • 27
  • 42