Hi John,
This what I did. I created a foder named
Pages
in the web application. Inside the Pages folder I added a
Partial Class
.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
namespace WebApp2.Pages
{
public partial class BasePage:Page
{
}
}
WebApp2 is the application name.
Then at the Page markup I use it as follows
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="~/Pages/BasePage.cs" CodeFileBaseClass="WebApp2.Pages.BasePage" Inherits="WebApp2.Pages.BasePage" %>
In an another test, I inherit this basePage class in the code behind like this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebApp2.Pages;
namespace WebApp2
{
public partial class _Default : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Hello");
}
}
}
In the markup
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="~/Default.aspx.cs" Inherits="WebApp2._Default" %>
However intellisense doesn't works, but it has no error and works fine. Is this example not work at your side?