开发者

Passing (Asp.Net) Session variable (uploaded by uploadify) from webmethod to same page?

开发者_开发知识库

When i try to get uploaded filename from generic handler (upload.ashx) using session its ok, no problem. I can also use webmethod on samepage and uploadify works great, but Session["fileName"] is getting null. Is there anything wrong on my code? Do i only need to use generic handler to get filename?

 [WebMethod(EnableSession = true)]      
    public void LoadPicture(HttpContext context)
    {
            try
        {
            HttpPostedFile file = context.Request.Files["Filedata"]; 

            context.Session["fileName"] = file.FileName;

....................Some resize and save image codes.........

            context.Response.Write("1");
        }
        catch (Exception ex)
        {
            context.Response.Write("0");
        }
   }

    protected void Button1_Click(object sender, EventArgs e)
    {

        using (_modelService = new ModelService())
        {
            ModelEntity _models = new ModelEntity();
                 ......some codes....
            _models.modelphoto = Session["fileName"].ToString();
            _modelService.ModelAdd(_models);
        }
    }


Uploadify uses Flash. Flash doesn't send cookies. In ASP.NET sessions are tracked by cookies. So, no session with uploadify, sorry.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜