Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CodeFile attribute is not supported by page directive

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi,

I am trying to teach myself C#.NET and am trying to create a blank page that uses a master page template.

My default.aspx page is as follows:

Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/dotnet/masterpages/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>

However I am getting an error message:

Parser Error Message: The 'CodeFile' attribute is not supported by the 'page' directive.

Source Error:


Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/dotnet/masterpages/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" %>
Line 2:
Line 3: <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


Source File: D:\Clients\dotnet\default.aspx Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2494; ASP.NET Version:1.1.4322.2494



Any ideas where I am going wrong?

Thanks very much

Ed
 
What framework are you using? It' can't possibly be version 1.1.
What version of visual studio are you using?
 
Hi there,

I am using Visual Studio 2010. I don't know how to check what framework I am using but my IIS server where the code is hosted is runing Windows Server 2003 R2. If I go into add/remove programs of the IIS server I can see there is Microsoft .NET Framework 3.5 SP1 (and hotfixes) as well as earlier versions of .NET framework. Is this what you mean?

Thanks very much

Ed
 
A bit more background info which might help you troubleshoot. The way I started was to create a new folder in an existing ASP classic website and then added my pages and folders in there.

On the IIS server if I right click the folder that has my .NET code in and view the properties and click ASP.NET tab it says it is using ASP.NET version 1.1.4322 but this is on a drop down menu that is greyed out.

Thanks

Ed
 
I would just start a whole new website or web project. Don't try to incorporate .net pages with classic asp pages.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top