Montag, 8. März 2010

Issue creating Application Page named “default.aspx” with Inherits-Statement

I just created an application page within an empty SharePoint 2010 project with Visual Studio 2010 RC.

I named the page “default.aspx”.

Visual Studio then generated the files and wrote

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="WebControls.Layouts.WebControls.@default" DynamicMasterPageFile="~masterurl/default.master" %>

in the aspx file.

This runs into an error. I don’t know why VS2010 writes @default instead of simply default in the “Inherits” statement. It only does when using “default.aspx” as the name for the application page. If you choose another name, no problem:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="mypage.aspx.cs" Inherits="WebControls.Layouts.WebControls.mypage" DynamicMasterPageFile="~masterurl/default.master" %>

Maybe a bug, maybe a feature.

Solution: simply delete the @ in the Inherits-Statement.

Keine Kommentare:

Kommentar veröffentlichen