在ashx一般处理程序文件中不能使用session和request的问题解决办法

<%@ WebHandler Language="C#" Class="ChangePwd" %>

using System;
using System.Web;
using System.Web.SessionState;
public class ChangePwd : IHttpHandler, IReadOnlySessionState
{
   
    public void ProcessRequest (HttpContext context)

   {
        context.Response.ContentType = "text/plain";
        OperUser ou = new OperUser();
        if (ou.ChangeWsPassword(context.Session["ws_user"].ToString(),context.Request.QueryString["pwd"].ToString()))
        {
            context.Response.Write("true");
        }
        else
        {
            context.Response.Write("flase");
        }
       
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}

加上红色部分就可以了


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yefengzhixia/archive/2009/06/12/4263112.aspx

posted @ 2009-07-25 18:45  小开的一天  阅读(470)  评论(0编辑  收藏  举报