Hi Chris,
I have write this piece of code to my sremoting object, that is in ther
server and the file is also in the server;
----------------------------------------------------------------------------
----------------------------------
public string fileContent()
{
string
localfilepath="C:\\Subjects\\DOT\\CSharpProjects\\DataAccess\\tutorial2.mdb"
;
StreamReader r = new StreamReader ((System.IO.Stream)
File.OpenRead(localfilepath));
string con=r.ReadToEnd();
r.Close();
return con;
}
----------------------------------------------------------------------------
-----------------------------------
And my client also access that remote object and get the string and write to
local file by following method
----------------------------------------------------------------------------
----------------------------------
public void writeFile(string con)
{
string
localfilepath="D:\\Subjects\\DOT\\CSharpProjects\\DataAccess\\tute.mdb";
StreamWriter r = new StreamWriter((System.IO.Stream)
File.OpenWrite(localfilepath));
r.Write(con);
r.Close();
}
----------------------------------------------------------------------------
---------------------------------
But it can copy the file but it becomes corrupted.
Can you pls tell me where am i making mistake .
Thanks
"Chris Taylor" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi,
>
> To copy a file from a server you can setup a share on a server and do
> something like the following
>
> System.IO.File.Copy( @"\\hulk\c\data\test.doc", @"c:\test.doc" );
>
> Where 'hulk' is the machine name, 'c' is the share name, 'data' is a
folder
> under that share and 'test.doc' is the file to copy.
> 'c:\test.doc' is the target on the local machine, where the file should be
> copied to.
>
> If what you want is to use FTP to transfere a file from the server to the
> client, there are a few approaches, but you could take a look at the
> following codeproject article as a starting point.
>
> http://www.codeproject.com/dotnet/dotnetftp.asp
>
> Hope this helps
>
> Chris Taylor
>
> "Shayer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi Chris,
> >
> > Thanks for your solution. ut i dont think it will work. Because i have a
> > server machine . when i start file copying using File.Copy ( ...) it
will
> > copy the file into the server machine. But dont want that. I want to
copy
> > the file to client machine which is running on separate computer.
> > Hope you may have a solution
> >
> > Thanks
> >
> > Shayer
> > "Chris Taylor" <(E-Mail Removed)> wrote in message
> > news:OG73#(E-Mail Removed)...
> > > Hi,
> > >
> > > The System.IO namespace has a File class, this class has a static
method
> > > called Copy. Would this not do the trick for you?
> > >
> > > Hope this helps
> > >
> > > Chris Taylor
> > > "Shayer" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Hello
> > > >
> > > > I want to copy a file from server to client machine. How can i do
> that.
> > I
> > > > may have to use byte stream but how can i do that . Pls tell me
> > > >
> > > > THanks
> > > >
> > > >
> > >
> > >
> >
> >
>
>