views:

21

answers:

0

I have a default.aspx in a folder _layouts/sandbox on the sharepoint server.

It has the following code:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

using System.Web.Configuration;

namespace sandbox
{

    public partial class _Default : LayoutsAppPage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            SPWeb web = SPContext.Current.Web;
            LabelTitle.Text = web.Title;

            if (Page.IsPostBack == false)
            {
                //Label1.Text = "Fahrenheit to Celsius:";
            }
        }

        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);

            try
            {
                this.MasterPageFile = SPContext.Current.Web.MasterUrl;
            }
            catch
            {
            }
        }



    }

}

it is supposed to inherint the LayoutsAppPage class so that I can use that to do the OnPreInit functions in all pages in the 'sandbox' application. here is the code to LayoutsAppPage.aspx.cs in the same directory

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

using System.Web.Configuration;

namespace sandbox
{
    public class LayoutsAppPage : System.Web.UI.Page
    {
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);

            try
            {
                this.MasterPageFile = SPContext.Current.Web.MasterUrl;
            }
            catch
            {
            }
        }
    }
}

i get the following error when running the page

c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\sandbox\Default.aspx.cs(20): error CS0246: The type or namespace name 'LayoutsAppPage' could not be found (are you missing a using directive or an assembly reference?)
at System.Web.Compilation.AssemblyBuilder.Compile()

i did notice that in the line "public partial class _Default : LayoutsAppPage" that LayoutsAppPage does not turn light blue like it should for the base class. If the line is "public partial class _Default : System.Web.UI.Page" the page loads fine. maybe i've declared the basepage incorrectly?

edit: by request -

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="sandbox._Default" MasterPageFile="~/_layouts/application.master" %>

<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages,Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Register TagPrefix="wssuc" TagName="InputFormSection" Src="/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" Src="/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" Src="/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBar" Src="/_controltemplates/ToolBar.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ToolBarButton" Src="/_controltemplates/ToolBarButton.ascx" %>