3

How do I fix this error?

I'm running .NET Framework v4.0.30319 so the Framework shouldn't be an issue. I'm not using any DLL files or bin directories. How do I setup the IIS/Virtual Directory if I'm using Forms Authentication for the whole website using VS2010?

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 
    'ACAWebApplication.Pages.State_Carrier_Search'.
Source Error:

Line 1:  <%@ Page Title="ACA Web App - State Carrier Search" Language="C#"
             MasterPageFile="~/Pages/User.Master" AutoEventWireup="true"
             CodeBehind="State_Carrier_Search.aspx.cs"
             Inherits="ACAWebApplication.Pages.State_Carrier_Search" %>
Line 2:  <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" 
             runat="server">
Line 3:      <style type="text/css">
Source File: /Pages/State_Carrier_Search.aspx    Line: 1

The Codebehind for State_Carrier_Search.aspx.cs file:

namespace ACAWebApplication.Pages
{
    public partial class State_Carrier_Search : System.Web.UI.Page
    {
        protected void Page_LoadS(object sender, EventArgs e)

The code for State_Carrier_Search.aspx file is as follows:

<%@ Page Title="ACA Web App - State Carrier Search" Language="C#" MasterPageFile="~/Pages/User.Master" AutoEventWireup="true" CodeBehind="State_Carrier_Search.aspx.cs" Inherits="ACAWebApplication.Pages.State_Carrier_Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">

thanks!

3 Answers 3

1

Thou shalt not name class and namespace the same

THIS is Your problem

namespace ACAWebApplication.Pages
{
    public partial class ACAWebApplication.Pages.State_Carrier_Search : System.Web.UI.Page
    {

The parser sees an ACAWebApplication.PAges namespace and sees ACAWebApplication.Pages class name. This is probably legal but it is very wrong

Drop the ACAWebApplication.PAges from the class name and it should work. Was it autogenerated or You have extracted the namespace from the class name. Either way change it

and read Eric lippert musings on it - whole series quite enlightening

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for the comment. Woops, I left that on after trying Mikhail's suggestion. Originally i had it as namespace ACAWebApplication.Pages{ public partial class State_Carrier_Search : System.Web.UI.Page and have updated the question to reflect that. I got that error w the namespace and class different. Thats what VS2010 auto-generated as the class and namespace. Any other suggestions?
Did this page work at all during it's history? did YOu change the name of the class, coverted the project from Web Application to Web Project or the other way round?
0

Is the .NET version correctly set in IIS? This could be a .NET 2.0 app trying to run on the 1.0 framework.

1 Comment

thanks for your response. Under the web.config file I set the framework to 4.0 under <system.web> <compilation debug="true" targetFramework="4.0"/>. I checked IIS Manager and just switched to win7 and it's displayed completely different so I'm not sure where to look but I don't see the acawebapplication listed in IIS. How do I set the IIS/Virtual Directory up for this app?
0

Please refer to the Specify a .NET Framework Version for an Application Pool (IIS 7) article to learn more how to specify a .NET Framework version for an application pool.

1 Comment

Thanks for your response. I looked under the IIS Application Pools and I am currently running .NET Framework v4.0.30319 so I should have no issues running anything. How do I setup the IIS/Virtual Directory for the whole website using VS2010?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.