Hi,
 
Here I am writing some code see it if u find any difficulty, let  me know. 
Although I am using same code to save file from one web server to another
 
##### Coding in Source Web Server( Say Source) From Where File has been 
uploaded #####
> Write this code on button click.
> Include required namespace i.e. System.Net
try
{
 try
 {
  string strAddress = "http://localhost/Destination/frmUpload.aspx";;
  string fileName   = "C:\\Test.txt";
  WebClient oClient = new WebClient();
  oClient.UploadFile (strAddress,"POST",fileName);
 }
 catch(Exception exp) { throw exp; }
}
catch(Exception Exp)
{
 Response.Write(Exp.Message);
}
 
##### Coding in Destination Web Server (Say Destination ) where file has to be 
copied #####
Create a web form named frmUpload.aspx and on the Page_Load write following code
private void Page_Load(object sender, System.EventArgs e)
{
 if (!IsPostBack)
 {
  if (Request.QueryString["licid"] != null)
  {
   string VarLicId = Request.QueryString["licid"].ToString();
   string strServerPath = "";
   // Note: Write Destination directory name where file has to be copied (say 
upload)
  
   strServerPath = Server.MapPath("upload") 
   string[] strFiles = Directory.GetFiles(strServerPath);
   int varCount = strFiles.GetUpperBound(0) + 1;
   varCount++;
   string FileName = "File_" + varCount.ToString() + ".xml";
   // Put user code to initialize the page here
   foreach(string f in Request.Files.AllKeys) 
   {
    HttpPostedFile file = Request.Files[f];
    // Check File Exists or Not
    if (File.Exists(strServerPath + "\\" + FileName))
     File.Delete(strServerPath + "\\" + FileName);
    file.SaveAs(strServerPath + "\\" + FileName);
   }
  }
 }
}
 
Please let me know whether this code fulfill your requirement or not 
Regards
 
Krishan Kant


nidhi upadhyay <[EMAIL PROTECTED]> wrote:
hi..

    I want to transfer file from one server to other server with asp.net..
    i dont know exactly but perhapes it may be done by webclient class 
    of asp.net but how can i do it ??

   if u have any idea abt this then pls reply me soon....

  thanks..

bye...

            
---------------------------------
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
AutherGen Technology (P) Ltd.,       Fax:       +91-172-5018485
24/3, Industrial Area, Phase - 2,    Mobile: 9888263726
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 --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/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