ashx文件中使用session提示“未将对象引用设置到对象的实例”
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.SessionState;
namespace friends {
/// <summary>
/// Handler 的摘要说明
/// </summary>
public class Handler : IHttpHandler, IRequiresSessionState {
public void ProcessRequest(HttpContext context) {
context.Response.ContentType = "text/plain";
···
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.SessionState;
namespace friends {
/// <summary>
/// Handler 的摘要说明
/// </summary>
public class Handler : IHttpHandler, IRequiresSessionState {
public void ProcessRequest(HttpContext context) {
context.Response.ContentType = "text/plain";
···
System.Web.SessionState.IReadOnlySessionState 为只读会话的接口
System.Web.SessionState.IRequiresSessionState 为可读可写的