Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to use my session and Hashtable in handler file.. than how i use ?
Please help me.
Posted

1 solution

Use this Example .. I think you will get your Solution..

C#
<![CDATA[<%@ WebHandler Language="C#" Class="Handler" %>]]>

using System.Web;
using System.Collections;
public class Handler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
    public void ProcessRequest (HttpContext context) {

        if (context.Session["userpseb2014"] == null || context.Session["userpseb2014"].ToString() == "")
        {
            context.Response.Redirect("../Default.aspx");
        }
        
            Hashtable objHT = new Hashtable();
            objHT = (Hashtable)context.Session["userpseb2014"];
            string str = objHT["User"].ToString();
        
        
        context.Response.ContentType = "text/plain";
        
        HttpPostedFile uploadFiles = context.Request.Files["Filedata"];
        string pathToSave = HttpContext.Current.Server.MapPath("signsect/") + uploadFiles.FileName;
        uploadFiles.SaveAs(pathToSave);
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }
}



Thanks
AARIF SHAIKH
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900