asp.net - VB.NET persistent cookie exception -


i attempting add text user types textbox 'textmain' cookie. trying there no need click 'save' button. therefore user type sentence , close browser , saved. here vb code; done on load handler , unload handler.

protected sub page_load(sender object, e eventargs) handles me.load     if not ispostback         if request.cookies("content") isnot nothing             textmain.text = request.cookies("content").value.tostring         end if     end if end sub  protected sub page_unload(sender object, e eventargs) handles me.unload     '' if request.cookies("content") nothing     dim contentcookie new httpcookie("content")     contentcookie.value = textmain.text     contentcookie.expires = datetime.maxvalue     response.cookies.add(contentcookie)    '' end if end sub 

the exception comes on respinse.cookies.add(contentcookie) line.

thanks!


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -