Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello all
how can read text file from client machine by using asp.net
if can not by using asp.net
how can doing that ?
Posted

You need to upload it before...

Read Client Side Text File in ASP.Net?[^]
 
Share this answer
 
Hi,
you can read textfile from client machine, only by fileupload control.
Client will upload their textfile, and then you can read textfile as below.
C#
FileUpload fup = fu1;// here fu1 is your file upload id
if (fup.HasFile)  
{
       StreamReader reader = new StreamReader(fup.FileContent);
       do
       {
              string textLine = reader.ReadLine();
       }
       while (reader.Peek() != -1);
       reader.Close();
}

Hope it helps you.
Thanks.
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900