// UI页面基类
public class PageBase : System.Web.UI.Page
{
//获得应用程序路径
public string ApplicationPath
{
get { return Request.ApplicationPath; }
}
}
//应用页
public class AppPage:PageBase
{
。。。。。引用UserControl
}
//WEB用户控件,在用户控件里引用Pagebase中的ApplicationPath属性
public partial class UserControl1 : System.Web.UI.UserControl
{
//PageLoad
protected void Page_Load(object sender, EventArgs e)
{
if (this.Page != null)
{
//获得对PageBase页的引用
PageBase pagebase = this.Page as PageBase;
//引用Pagebase页的ApplicationPath属性
pagebase.ApplicationPath;
}
}
}