我想实现单点登录,当下面代码出项了一些问题,请帮忙解决一下谢谢了。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        int i = this.checkLogin(Textname.Text,Textpwd.Text);
        if(i>0)
        {    
            string str_Key = Textname.Text + "_" + Textpwd.Text;
            //得到Cache中的给定的值str_Key
            string str_User = Convert.ToString(Cache[str_Key]);
            //Cache中如果没有str_key的项目,那么用户没有登录
            if(str_User==string.Empty)
            {
                TimeSpan SessTiomeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
                Session["User"]=str_Key;
                //首次登陆成功
                Response.Write("<h2 style='color:red'>您好,登录成功");            }
            else
            {
                // 在 Cache 中存在该用户的记录,表名已经登录过,禁止再次登录 
                Response.Write("<h2 style='color:red'>抱歉,您好像已经登录了!");
                return ;            }
           
        }
        else{
            Response.Write("用户名称或密码错误!!!");         }
    }    private int checkLogin(string p, string p_2)
    {
       
                return 1;
         
    }      
}