I am very new to ASP.net and never used this feature before. I am trying to generate a code that will generate random numbers. The numbers must be in the range from 10-100. This is what I have generated. However, I am still running into some difficulty.

// test.aspx.cs
// The code behind file for test.aspx
// Includes a function to build an array of ten pseudorandom
// numbers
using System;
using System.Web;
using System.Web.UI;
public class test : Page
{
    // Build a pseudorandom number method
    System.Random RandNum = new System.Random();
    int MyRandomNumber = RandNum.Next(10, 100);
    protected int[] myArray = new int[10];
    // A method to fill the array with pseudorandom numbers
    public void fillArray()
    {
        for (int index = 0; index < 10; index++)
            // Generate a pseudorandom number in the range of 10 to 100
            myArray[index] = randomGen.Next(10, 100);
    }
}

................................................

<!-- test.aspx
A simple example of an ASP.NET document with a code-behind file
It has the same functionality as test.aspx
-->

<%@ Page Language="C#" Inherits="test" Src="test.aspx.cs" %>

<html>
<head>
    <title>test</title>
</head>
<body>
    <!-- Code to call the fillArray method and display the array-->
    <% string msg;
       fillArray();
       Response.Write(
       "<br /> <b>The array’s contents are: </b><br /><br />");
       for (int index = 0; index < 10; index++)
       {
           msg = string.Format("The element at {0} is: {1} <br />",
           index, myArray[index]);
           Response.Write(msg);
       }
    %>
</body>
</html>

What is the difficulty you are having (Specifically).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.