Return to Snippet

Revision: 27649
at February 22, 2011 02:44 by fengelz


Updated Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MyGenericHandler
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>

    public class Handler : IHttpHandler, 
    System.Web.SessionState.IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
           context.Session.Add("myVal", 
              context.Request["myVal"]);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

Revision: 27648
at February 22, 2011 02:35 by fengelz


Updated Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MyGenericHandler
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>

    public class Handler : IHttpHandler, 
System.Web.SessionState.IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Session.Add("myVal", context.Request["myVal"]);

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

Revision: 27647
at June 18, 2010 22:15 by fengelz


Initial Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MyGenericHandler
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>

    public class Handler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Session.Add("myVal", context.Request["myVal"]);

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

Initial URL


Initial Description
If you are working with an ashx handler and need to access your session, this is one way it can be done.

Initial Title
Maintain sessionstate in generic ashx handler

Initial Tags


Initial Language
C#