locked
Unable to retrieve session variable value. RRS feed

  • Question

  • User400339653 posted

    I have set login value in the session variable. Now I want to retrive it through jquery in order to show some items only if value is present session variable. 

    For that i tried: 

    '<%= Session["User"] %>'
    but it doesn't work, so give me some other ways so as to retrive value.
    
    

    Friday, March 15, 2013 2:45 PM

Answers

  • User-987211141 posted

    Hi nelson123,

    You just store session value in hidden field in your page and access this value using getElementById or getElementByName.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 16, 2013 2:54 AM

All replies

  • User-987211141 posted

    Hi nelson123,

    You just store session value in hidden field in your page and access this value using getElementById or getElementByName.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 16, 2013 2:54 AM
  • User1474546121 posted

    client side code cannot see server-side variables. you have to output the session value onto the page somewhere, maybe within a var or directly in the alert.

    var someVar = "<%Session("OwnerIndicator")%>";

    Saturday, March 16, 2013 3:05 AM