<%@ WebHandler Language="C#" Class="Upload" %>
using System; using System.Web; using System.IO; using System.Web.UI; using System.Configuration; using System.Web.SessionState; public class Upload : IHttpHandler, IReadOnlySessionState { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Expires = -1; try { HttpPostedFile postedFile = context.Request.Files["Filedata"]; string savepath = ""; string tempPath = ConfigurationManager.AppSettings["Filedata"]; savepath = context.Server.MapPath(tempPath); string filename = postedFile.FileName; if (!Directory.Exists(savepath)) Directory.CreateDirectory(savepath); postedFile.SaveAs(savepath + @"\" + filename); context.Response.Write(tempPath + "/" + filename); context.Response.StatusCode = 200; if (postedFile != null) { context.Session["img"] = postedFile.FileName; } else { context.Session["img"] ="No File Uploaded"; } } catch (Exception ex) { context.Session["img"] = "Throwed exception when uploading file"; } } public bool IsReusable { get { return false; } } } Document.aspx.cs if (Session["img"].ToString() != null) { // this session return correct value in chrome //but firefox it return null value only } Advance Thanks
if (Session["img"] != null) { //put your logic here }
txtUploadFile.SaveAs(SharedPath + "\\" + Session["img"].ToString());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)