1 无效的指针
就是这句话  Response.Write("<script language='javascript'>alert('请先登陆');location.href='login.aspx';</script>");
在我的机子上运行得好好的,一移植到服务器上就不出原来的那个的效果了,,而且在状态栏上显示出现无效的指针2 一个页面中需要多次从Session["student_id"]中取值 我把他放到一个静态字符中,结果混乱得不成样子了,好像是大家公用了这个静态字 串了  一个用户登陆后所有人的页面上的Session["student_id"]都变成最后这个登陆的人了

解决方案 »

  1.   

    1.不知道原因
    2.觉得不太可能。session并不是谁都可以改变的,你这个session的值是不是和公共变量的同名?就是application("变量名")这样定义的变量
      

  2.   

    2.觉得不太可能。session并不是谁都可以改变的,你这个session的变量名是不是和全局公共变量的同名?就是application("变量名")这样定义的变量
      

  3.   

    static string student_id = Session["student_id"].ToString();仅仅是如此
    我用我的帐号登陆,而写进数据库的是别人的记录
      

  4.   

    我都不收想像服务器不会把我的静态字段当成application的值,让大家公用了吧
      

  5.   

    肯定是出在static全局变量上,多用户共享student_id.第一个人操作的结果影响了其他人!
    改用ViewState[]试下!
      

  6.   

    static string student_id = Session["student_id"].ToString();
    这个student_id是全局的三
      

  7.   

    结贴了,,兄弟们,害得我搞乱了学校的数据,,惨,,
    告诉大家呀
    static string student_id = Session["student_id"].ToString();
    这种student_id是全局的,,类似的 application我们几个人做过实验了
      

  8.   


    测试代码,,用登陆的人的IP判断
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;namespace gxk
    {
    /// <summary>
    /// temp 的摘要说明。
    /// </summary>
    public class temp : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Label Label1;
    protected System.Web.UI.WebControls.Button Button1;
    static string AAA="";

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    if(!IsPostBack)
    {
    bind();
    }
    } #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.Load += new System.EventHandler(this.Page_Load); }
    #endregion private void Button1_Click(object sender, System.EventArgs e)
    {
    this.Label1.Text=AAA;

    }
    private void bind()
    {
    if(Request.ServerVariables["HTTP_VIA"]!=null)

    AAA=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); 
    }
    else

    AAA=Request.ServerVariables["REMOTE_ADDR"].ToString(); 
    }
    }
    }
    }