Form, cookies and viewstate

Last post 03-20-2008 2:58 PM by Stern9. 4 replies.

Sort Posts:

  • Form, cookies and viewstate

    03-20-2008, 2:17 PM
    • Member
      point Member
    • Stern9
    • Member since 03-20-2008, 2:03 PM
    • Posts 3

    Hello!

    I have a form on the page, and user can submit it only once, if he submits the data again, it must be compared to the information he provided earlier and if it is new (it has been changed somehow), then he can post the form again.

    I use ViewState and  compare values stored earlier with the text in form fields. It works just perfect in the cycles of postbacks, but when user goes to another page and then returns, the Viewstate values are lost. I think i should use cookies, but cookies have got limited size (less than 2 KB) . Should I try them with Viewstate or Viewstates aren't needed? Or maybe Session variables are better?

    Which way should I choose? 

     

     

  • Re: Form, cookies and viewstate

    03-20-2008, 2:25 PM
    • Participant
      1,018 point Participant
    • ely79
    • Member since 03-17-2008, 1:56 PM
    • Denver, Colorado
    • Posts 188

    Where are you permantely storing the results of the form?  That should be what you compare it against.

  • Re: Form, cookies and viewstate

    03-20-2008, 2:35 PM
    • Member
      point Member
    • Stern9
    • Member since 03-20-2008, 2:03 PM
    • Posts 3

    I store the results in database, but it means i need to make a query to it each time the user wants to post a form and compare his current results with each request he ever made (using his ip (or something) stored in cookie). 

     

  • Re: Form, cookies and viewstate

    03-20-2008, 2:45 PM
    Answer
    • Participant
      1,018 point Participant
    • ely79
    • Member since 03-17-2008, 1:56 PM
    • Denver, Colorado
    • Posts 188

    In that case, either cookies or session state will be your best bet, since you don't have a reliable way to identify the user.  If your data is larger than what a cookie will support, then you are limited to session.  Problem with session is that once the user closes the browser or times out, the values will be lost.

  • Re: Form, cookies and viewstate

    03-20-2008, 2:58 PM
    • Member
      point Member
    • Stern9
    • Member since 03-20-2008, 2:03 PM
    • Posts 3

    thank you for advice! Smile I'll think

Page 1 of 1 (5 items)