4

On my page I have:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="siteSettings.aspx.cs" Inherits="APack.admin.siteSettings" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html>

My code behind is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace APack.admin
{
    public partial class siteSettings : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

It throws the exception:

Parser Error Message: Could not load type 'APack.admin.siteSettings'.

This was just produced in Visual Studio, right click - > new file. It just doesn't work :( Any ideas?

3 Answers 3

10

Have you built the application?

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

4 Comments

I was under the impression that when I run the web page from the server it compiles it for you?
No idea why it worked but it did :) thanks! Any explanation?
A Web site project is compiled on the fly. Web Application projects are not.
Can you clarify the step? I've tried with the same skeleton app and built the app, then published it an still getting that error
1

I think I have found one of the possible solution, click "project name"."properties", then name "Root namespace" to the web application name, such as "YourNamespace", then recompile dll

1 Comment

Doesn't seemed to have changed anything
0

I answered your question here: C# Visual Studio 2010 - 'Could not load type' Parse error


You are missing your assembly reference above the page reference:

<%@ Assembly Name="YOURASSEMBLY.NAME, Version=1.0.0.0, Culture=neutral, PublicKeyToken=YOURPUBLICKEYTOKEN" %>

Comments

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.