how to read twice a file using fileupload
<p>I am trying to read the same file twice.</p>

<p>I have been using a <code>FileUpload</code> to look up the file. I was successful in the first read where I find out how many lines the file have, using the next code in C# ans asp.net:</p>

<pre><code>Stream data_file;
data_file=FileUpload1.PostedFile.InputStream;
string line;
int elements;
StreamReader sr = new StreamReader(data_file);
line = sr.ReadLine();
while (line != null)
{
elements = elements + 1;
line = sr.ReadLine();
}
sr.Close();
</code></pre>

<p>With this number I can now create an array of array by setting fist how many elements the array is going to hold. The array this time is going to hold the number from the file something like this:</p>

<p>datafile:</p>

<p>1,1</p>

<p>2,3</p>

<p>arrayL[0][0]=1</p>

<p>arrayL[0][1]=1</p>

<p>arrayL[1][0]=2</p>

<p>arrayL[1][0]=3</p>

<p>so the code to do this is the next:</p>

<pre><code>double [][] dime= new double [elements][];
string[] div;
string line2;
int nn=0;
StreamReader ssr = new StreamReader(data_file);
line2 = ssr.ReadLine();
while (line2 != null)
{
dimen[nn] = new double[2];
for (int m2 = 0; m2 &lt; 2; m2++)
{
div=line2.Split(new Char[] { ' ', ',', '\t' });
dimenc[nn][m2] = Convert.ToDouble(div[m2]);
}
nn=nn+1;
line2 = ssr.ReadLine();
}
ssr.Close();
</code></pre>

<p>However, the array says that it is empty but I know if I used the second part of the code in a complete diferrent method/ second button but if it is in the same method it does not work so my question is: </p>

<p>What's wrong? Why the second streamreader is not working?</p>
