当session为空时不能打开这个页面怎么判断?
判断session的页面为check.aspx.cs,
需要打开的页面为webform.aspx.我应该怎么写呢?
<!--#include file="check.aspx" --> 这样?

解决方案 »

  1.   

    if(Session[""] != null)
    {
      redirect("webform.aspx");
    }
    else
    {
      //
    }
      

  2.   

    // 判断身份是不是管理员
    private bool ChkAdmin()
    {
    if(Session["name"]!=null)
    {
    return true;
    }
    else
    {
    return false;
    }
    }
    private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here
    if(Page.IsPostBack==false)
    {

    try
    {
    if(ChkAdmin())
    {
    webform.aspx;
    }
    else
    {
    error.aspx
    }
    }
    catch(Exception ex)
    {
    Label1.Text=ex.Message;
    }
    }
    }
      

  3.   

    hehe,写错了
    是Response.Redirect("webform.aspx");和Response.Redirect("error.aspx");
      

  4.   

    多谢楼上2位。。
    c#中有<!--# inlude file="error.aspx"-->这种写法吗?
    如果没有,那是怎么插入其他页面的?
      

  5.   

    <asp:HyperLink ID="EditFormNum" NavigateUrl='<%# "dsp_NewFrm.aspx?Form_Num=" + DataBinder.Eval(Container.DataItem,"Form_Num") + "&Emp_Num=" + DataBinder.Eval(Container.DataItem,"Emp_Num") runat="server" Visible="False"#%>