asp.net - Session variable getting lost using Firefox, works in IE -


i setting session variable in httphandler, , getting value in page_load event of aspx page. i'm setting using

    public void processrequest(httpcontext context)     {         httppostedfile file = context.request.files["filedata"];         context.session["workingimage"] = file.filename;     } 

(and before suggests check validity of file.filename, same problem occurs if hard-code test string in there.) it's working fine in ie, in firefox session variable not found, getting "object reference not set instance of object" error in following code:

   protected void page_load(object sender, eventargs e)    {         string loc = session["workingimage"].tostring();    } 

has encountered problem - , come means passing session variable?

this httphandler? if chance has flash, , flash making request, interested in reading the flash cookie bug. basically, flash forwards ie cookies.

the easist fix call correctcookie @ application_beginrequest in global.asax , put sessionid in querystring of flash request.

public shared sub correctcookie()     try         dim session_cookie_name string = "asp.net_sessionid"         dim session_value string = httpcontext.current.request.querystring("sid")         if session_value isnot nothing             updatecookie(session_cookie_name, session_value)         end if     catch ex exception     end try end sub  private shared sub updatecookie(byval cookie_name string, byval cookie_value string)     dim cookie httpcookie = httpcontext.current.request.cookies.[get](cookie_name)     if cookie nothing         dim cookie1 new httpcookie(cookie_name, cookie_value)         httpcontext.current.response.cookies.add(cookie1)     else         cookie.value = cookie_value         httpcontext.current.request.cookies.[set](cookie)     end if end sub 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -