Click here to Skip to main content
11,718,016 members (82,794 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET Parser
Now, I know what you're thinking ("Not another parser error!"). But my situation is unique. (No, really! Wink | ;-) ) I could use your help. Let me tell you what the error is:

Server Error in '/' Application.
Parser 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 'TestCert'.
Source Error:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestCert.aspx.cs" Inherits="TestCert" %>
Line 2:
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

Source File: /TestCert.aspx    Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3634

The situation is I have a bunch of .aspx and .aspx.cs files behind https, all in a lump together. There is no solution file and no project file (not my idea).

What I've tried so far:
1. The project file is called TestMMW, so the whole thing was under the namespace TestMMW. I tried taking the namespace off (which you see up above). Error.
2. I tried putting the namespace back on. Error.
3. I noticed that it's running under version 2 of .Net and ASP.NET, so I installed Visual Studio 2008 (to be sure - I generally work under VS 2010), compiled under there, making sure the .Net version was 2.0, and FTPd it over. Error.

I'm at a loss for what to try next. Can you help me, please?

Posted 30-Apr-12 6:44am
B Birajdar at 1-May-12 0:50am
My +5. For nicely framed question
B Birajdar at 1-May-12 0:51am
Reason for my vote of 5
Well explained question
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Check that the codebehind class is

public partial class TestCert:Page


Also try changing CodeBehind="TestCert.aspx.cs" to CodeFile="TestCert.aspx.cs". This change is required when you change project type from website to webapplication or vice versa.

Since you are saying that the project does not contain the project file or solution file, I think the problem is here. The IIS is not able to understand the project type.

Since you are FTPing to IIS, are you sure that you are using the .NET 2.0 AppPool ?
Miriam Weiss at 1-May-12 16:08pm
Can you explain to me why the CodeFile versus the CodeBehind? It worked, but I would like to know why.
Amogh Natu at 12-Aug-13 7:56am
I did the same but with still the same result. I searched else where and found a stackoverflow forum that suggests me to change the output directory to Bin. I did that and still I'm having the same error. Can anyone help please? Thank you!

Stack overflow link :
B Birajdar at 2-May-12 1:52am
I am glad I could help you.

I dont know the exact reason but once I added some pages from a website to a webapplication in and encountered similar error. So I made a diff and found the difference. I made the above change and worked...
B Birajdar at 2-May-12 1:56am
This link throws some light on it
KYAW MYO AUNG at 23-Jul-14 5:31am
Thanks you for your help
Clark Kent123 at 30-Sep-14 15:25pm
I know that this is an old post, but this has solved my problem! Thanks! +5 :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try to copy the bin folder to your webserver.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Had the same issue, solved by verifying the Netframework versión of the application pool in IIS. My application was versión 4.0 and the application pool was 2.0 . Changed it for the App pool from 2.0 to 4.0 and it worked fine, no need to change the CodeBehind to CodeFile.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 874
1 OriginalGriff 215
2 F-ES Sitecore 210
3 Maciej Los 140
4 Jochen Arndt 120
0 Sergey Alexandrovich Kryukov 1,649
1 OriginalGriff 535
2 Maciej Los 529
3 Richard MacCutchan 440
4 CHill60 415

Advertise | Privacy | Mobile
Web02 | 2.8.150901.1 | Last Updated 3 Nov 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100