ashx.cs 读写session

添加命名空间using System.Web.SessionState;

 

其中:System.Web.SessionState.IReadOnlySessionState  为只读会话的接口;System.Web.SessionState.IRequiresSessionState 为可读可写会话的接口 

public class GoodAnswer : IHttpHandler, IRequiresSessionState//接口
{

     if (HttpContext.Current.Session["serverCode"].ToString() == servercode)
           return "1";

}

你可能感兴趣的:(session)