adding two numbers in a session
<p>I am doing a web application in ASP.net / C# where a random number (num1) is generated on a Page_Load event. In the web page there is a button, whenever the user clicks that button a new random number (num2) is generated and it is added (+) to the previous one in a Button_Click event. This keeps on going infinitely (keep on adding a new random number to the last addition).  I have tried using sessions I did not find a clear example. I would really appreciate your suggestions and help. </p>

<p>Code:</p>

<pre><code>private static Random random = new Random();
        private int randomNumber(int min, int max)
        {
            return random.Next(min, max);
        }


        protected void Page_Load(object sender, EventArgs e)
        {
             number1 = randomNumber(1, 10);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int number2 = randomNumber(1, 10);
            Session["number_x"] = number2;
            number2 += number1;
        }
</code></pre>

<p>Lets say on the page_load the random number generated is 4. The user then clicks the button which generates a new random number lets say 5. Now 5 should be added to 4 = 9. If the user again clicks the button generating again a new number say 5, so now the session should have 14 and so on. </p>

<p>Thanks. </p>
