Basically, there are two approaches to this problem, you can store the current question (currently the i variable as a session variable, e.g.
Session["CurrentQuestion"]
, and when the user logs out, make sure to clean and abandon the session like this:
Session.Clear();
Session.Abandon();
Otherwise, you can use the IsPostback property to reset the current question:
public void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
i = 0;
}
...
}
This will only reset the current question on the first visit to the page, not after navigating to the next or previous question