Hi,
  
1) Place a button on web page.
2) Write following code on button_click and page_load.
3) On Button click I upload the file from the client machine to the same page 
and on page_load I am checking 
   the uploaded file count. If it is greater than 0 means some file is send to 
the server. But in Page_Load
   I am reading the content of the uploaded file (i.e. client file)
4) Include using System.Net; using System.IO; namespace
5) On Button Click I am using upload file method of WebClient class. In order 
to use this method u have to pass
   serverpagepath,method to post file, clientfilename
4) Code is as follows
  private void Page_Load(object sender, System.EventArgs e)
  {
   // Put user code to initialize the page here
   if (Request.Files.Count > 0 )
   {
    Stream MyStream = Request.Files[0].InputStream;
    StreamReader strRead = new StreamReader(MyStream);
    ViewState["FileContent"] = strRead.ReadToEnd();
   }
  }
  
  private void Button1_Click(object sender, System.EventArgs e)
  {
   try
   {
    // Path of the server file.
    string strServerFile = 
"http://localhost/SalesTeamLiveV2_3/Client/FrmTest.aspx";
    // Client file to be read.
    string strClientFile = "E:\\Test.txt"
    WebClient oClient = new WebClient();
    // Upload client file to the server page where we read file.
    oClient.UploadFile (strServerFile ,"POST",strClientFile);
   }
   catch(Exception exp)
   {
    Response.Write(exp.Message);
   }
  }
 
Arindam Please Let me KNOW whether this code solve your problem or not.
 
Regards 
KK
 


Arindam <[EMAIL PROTECTED]> wrote:
Hi 
this sounds very easy , but actually not,
How can i read a plain text file kept in 
c:/Programme File/fname.txt of client machine
from my c# web applicantion

I will be realy greatful if any one can give a correct answer 
with an example.

thanks 
arindam



Arindam Chakraborty
Software Developer,
Mumbai,
India




            
---------------------------------
Yahoo! India Matrimony: Find your partner now.

[Non-text portions of this message have been removed]



SPONSORED LINKS 
Basic programming language Computer programming languages Programming languages 
Java programming language The history of computer programming language 

---------------------------------
YAHOO! GROUPS LINKS 


    Visit your group "AspNetAnyQuestionIsOk" on the web.
  
    To unsubscribe from this group, send an email to:
 [EMAIL PROTECTED]
  
    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


---------------------------------





--------------------------------------------------------------------
Krishan Kant Chamoli                 Office:    +91-172-2653886
AuthorGen Technology (P) Ltd.,       Fax:       +91-172-5018485
24/3, Industrial Area, Phase - 2,    Mobile: 9888263769
Chandigarh. INDIA. Pin - 160002.     Email: [EMAIL PROTECTED]

--------------------------------------------------------------------
Send instant messages to your online friends http://uk.messenger.yahoo.com 

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Reply via email to