jquery - How can I keep all html in session with webservice? -


i want keep full html in page in session using webservice set session step throw exception.

object reference not set instance of object.

my functions

[webmethod(description = "gsetsession")] [scriptmethod(usehttpget = false)] public void setsession(string html) {     httpcontext.current.session["html"] = html; }  [webmethod(description = "getsession")] [scriptmethod(usehttpget = false)] public string getsession() {     if (httpcontext.current.session["html"] != null)     {         return httpcontext.current.session["html"].tostring();     }     else      {         return "";     } } 

in web methods, make sure enable session

[ webmethod(description="get session",enablesession=true)] 

reference


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -