try
private void Page_Load(object sender, System.EventArgs e)
{
if(Session["EmailAddr"] == null)
{
throw new HttpException(404, "Page Not Found");
}

解决方案 »

  1.   

    加个判断把它捕获吧~
    private void Page_Load(object sender, System.EventArgs e)
    {
    if(Session["EmailAddr"] == "" || Session["EmailAddr"] == null)
    {
    throw new HttpException(404, "页面未找到");
    }
    }
      

  2.   

    private void Page_Load(object sender, System.EventArgs e)
    {
    if(Session["EmailAddr"] == null)
    {
    throw new HttpException(404, "Page Not Found");
    }
                  catch
                 {
                   this.Response.StatusCode =404;
    this.Response.Cache.SetNoStore();
    this.Response.End();              }