View Single Post
Join Date: Oct 2008
Posts: 8
Reputation: n4naeem is an unknown quantity at this point 
Solved Threads: 1
n4naeem n4naeem is offline Offline
Newbie Poster

Re: reading a text file to a remote PC

 
0
  #5
Oct 21st, 2008
it is very simple with asp net .

Put a File Upload Button in yours controls.

suppose there is a button on urs controlls READ.

on the event handler Read on click event use this Code.

suppose FileUpload button have the ID

File1.PostedFile.SaveAs(Server.MapPath(filename to save));

for reading a file

String strXMLFileContent = "";
using (StreamReader SR = new StreamReader(Server.MapPath(FIle Name on which you have saved)))
{
while (SR.EndOfStream == false)
{
strXMLFileContent += SR.ReadLine();

}
SR.Close();
}


to delete File


File.Delete(Server.MapPath(Filename to delete from Server);
Reply With Quote