BuildManager.CreateInstanceFromVirtualPath返回null值

时间:2013-03-22 11:49:07

标签: c# asp.net

为什么显示的值为空

 public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
    var display = BuildManager.CreateInstanceFromVirtualPath(
                    _virtualPath, typeof(Page)) as IDisplay;
    return display;
}

_virtualPath的值是字符串

的'〜/ RegisterUser.aspx'

1 个答案:

答案 0 :(得分:0)

在您的页面中,代码隐藏继承自IDisplay示例:

using System.Web.UI;
using System.Web.UI.WebControls;

public partial class secondpage: System.Web.UI.Page, **IDisplay**     <--------------------
{
    protected void Page_Load(object sender, EventArgs e)
    {

    } 
}