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.

Advertisements

About binoeder

SharePoint and Project Server Consultant
This entry was posted in SharePoint. Bookmark the permalink.

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

  1. Oisin says:

    It does this (mistakenly) because default is a c# 3.0 language keyword. It is used for initializing variables which are generic types.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s