probably not possible, if you can access a session based on sessionid, I think there are security problems

解决方案 »

  1.   

    我需要在服务器端检查一个sessionid是否还存在,这样不可能实现吗?
      

  2.   

    not possible, unless your session states are saved in a database and you can access that database,....
      

  3.   

    if you want to roll your own, you can always maintain the session state by yourself, see
    A Scalable Alternative to Session Variables 
    http://www.4guysfromrolla.com/webtech/041600-2.shtml
      

  4.   

    saucer(思归) 就是微软专家,你没看出来他没用过汉语吗?他是billgates的表弟(或表妹),i think
      

  5.   

    判断一下SESSION是否为空
    SESSON["id"]==null or SESSON["id"]!=null
      

  6.   

    Session["yourname"]==null
    Session["yourname"]==""
      

  7.   

    感谢您使用微软产品。在ASP.NET中,我们不可能直接通过SessionID, 在Session外部得到该Session对象或者判断该对象是否还存在。如果您需要达到这个要求,建议您参阅下面的代码,我们把SessionID存在自己的Hashtable中://///////////////////////////////////////////////////////////////////////////
    GLOBAL.ASAX.CSprotected void Application_Start(Object sender, EventArgs e)
    {
           Hashtable ht = new Hashtable();
           Application["SessionIDs"] = ht;
    }protected void Session_Start(Object sender, EventArgs e)
    {
           Hashtable ht = (Hashtable) Application["SessionIDs"];
           ht.Add( Session.SessionID, Session.SessionID );
    }protected void Session_End(Object sender, EventArgs e)
    {
           Hashtable ht = (Hashtable) Application["SessionIDs"];
           ht.Remove( Session.SessionID );
    }in order to know if a session is alive we use this method:public bool IsSessionAlive( string id )
    {
           Hashtable ht = (Hashtable) Application["SessionIDs"];
           return ht.ContainsKey( id );
    }///////////////////////////////////////////////////////////////////////希望对您有所帮助。-微软全球技术中心  -zgh本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
    为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。