+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Retain information between postbacks for use in navigation flow

Retain information between postbacks for use in navigation flow

4 posts, 0 answered
  1. Omar
    Omar avatar
    11 posts
    Registered:
    23 Mar 2011
    23 Mar 2011
    Link to this post

    Hi!
     
    We have the following three page scenario (Look in the attachment)

    In Page 1 the user enters a zip code in a textbox that’s included in a custom widget. Then the user presses a submit button (also included in that widget). The post back validates the zip code and then needs to store it somewhere. After that the user is redirected to Page 2 (say “~/page2”). Page 2 is a content-only page (i.e. without any custom widgets) with a link to Page 3 (say href="~/page3"). Page 3 contains a custom widget that needs to use the zip code stored in Page 1’s post back. How could we store and later retrieve the zip code? Where should we store it?

    thanks in advance,

    Omar

  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    28 Mar 2011
    Link to this post
    Hi Omar,

    there are three options to solve this issues, you should choose the most appropriate one depending on your scenario:

    1) Pass the zip code through query string between pages (you can encrypt it shouldn't be hackable)
    more info: http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx

    2) Store the zip code in a cookie (simplest option and today, with cookies being used on almost every single app, should work fine)

    more info (writing a cookie): http://msdn.microsoft.com/en-us/library/aa287547(v=vs.71).aspx
    more info (reading a cookie): http://msdn.microsoft.com/en-us/library/aa287533(v=vs.71).aspx

    3) Store the zip code in the Session object
    more info: http://msdn.microsoft.com/en-us/library/ms178581.aspx
     
    Hope this helps.

    Regards,
    Ivan
    the Telerik team
  3. Omar
    Omar avatar
    11 posts
    Registered:
    23 Mar 2011
    28 Mar 2011
    Link to this post
    Ivan,
            Thanks for your answer, this mean that in a web farm context the only way to solve this issue is with Session using a SQL as repository or some type of affinity to use session in memory. It is correct?
            My concern is the performance downgrading of the site for the SQL to manage session between farm nodes.

    Regards,

    Omar
  4. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    28 Mar 2011
    Link to this post
    Hello Omar,

    Well, if you are  talking in the webfarm context, I'd suggest going either with query strings or cookies, as that way you will move that logic to the client and simplify implementation a lot.

    As for the sessions, you are right... you'd need to move that in SQL or some other repository.

    Kind regards,
    Ivan
    the Telerik team
Register for webinar
4 posts, 0 answered