View Full Version : Refresh and postback

12-07-2004, 11:21 PM

Yeah, it's me and my newbie questions again.

For an ASP.NET assignment, I am making a quiz with random questions. The question should only change when the user presses the button, so in order to keep the same question on the screen when the user reloads the page, I tried to put my code between an "if not IsPostBack"-check. I always assumed a simple refresh returned IsPostBack to true.

But in contrast to what I assumed, IsPostBack returns false even if the user simply refreshes the page. I thought you had to completely renew the page for that (by closing the window or adding a space to the URL or something like that).

Since a refresh is apparently not a postback, is there any way to get around this? I suspect cookies might do the trick, but I am not sure.