tags:

views:

27

answers:

1

The following code is working on IE but not on Firefox. The following code is setting session on *.ashx file.

public class Upload : IHttpHandler, IRequiresSessionState
{
    public string PATH = System.Web.HttpContext.Current.Request.MapPath("..") + @"\UploadFiles\";
    public string prefix = "ANNUAL_";
    public void ProcessRequest(HttpContext context)
    {            
        HttpPostedFile file = context.Request.Files["Filedata"];
        file.SaveAs(PATH + prefix + file.FileName);                
        HttpContext.Current.Session["filename"] = file.FileName;  
        context.Response.Write("1");
    }
}

Getting session in *.aspx file is as follows. Even though I can set value into the sessions in *ashx file, the session value is null when session arrives in the *.aspx file. How can I solve my problem? Could you please give any solution about my problem?

using System.Web.SessionState;
public partial class frmImport : System.Web.UI.Page, IReadOnlySessionState
{
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string temp = HttpContext.Current.Session["filename"].ToString();
    }
}
A: 

Put the following code in Web.Config

<configuration>
   <system.web>
<sessionState mode="InProc"  cookieless="true" />

The problem has gone !

linnaryone
I hope you understand the implications, and not only did it because 'it works' :(
eglasius