Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 678651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:10:24+00:00 2026-05-14T01:10:24+00:00

I am using asp.net, c#, MVC and nHibernate and I am trying to upload

  • 0

I am using asp.net, c#, MVC and nHibernate and I am trying to upload a file from a local machine to the server and replicate the file to the different server. I was able to upload file to the server and copy the file from one folder to the other folder on the same server without any problem.But how can I copy the file from one server to another server.
Please follow the link to see how to copy a file from one folder to another folder on the same server.
Click to see my answer to the file upload question.[please look for answer by kalyan]

Please help. Thank you.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:10:25+00:00Added an answer on May 14, 2026 at 1:10 am

    Finally I got it figured out.. here is the sweet code for my own problem.
    Side Note:(part I was missing before..) Before you do any thing you should have a FTP site. So, from the IIS (on the server) create a FTP site and point the root directory to the folder that you want to upload or download and manually change the username and password (mine: username: administrator, password: sweet123) from the properties of the site if necessary. (steps are very simple u can easily understand once u start creating an FTP site). I assume that you have your FTP site ready. Now, let us say the url is ftp://10.2.1.111/Images/.
    And dont forget to add System.Net and System.IO to your namespace.
    now from your code.

            string CompleteDPath = "";
                CompleteDPath = "ftp://10.2.1.111/Images/";
    
    
                string UName = "";
                string PWD = "";
                UName = "administrator";
                PWD = "sweet123";
    
    
                WebRequest reqObj = WebRequest.Create(CompleteDPath + fname);
                reqObj.Method = WebRequestMethods.Ftp.UploadFile;
                reqObj.Credentials = new NetworkCredential(UName, PWD);
                FileStream streamObj = System.IO.File.OpenRead(_FULLlocalpathofthefile + fname);
                byte[] buffer = new byte[streamObj.Length + 1];
                streamObj.Read(buffer, 0, buffer.Length);
                streamObj.Close();
                streamObj = null;
                reqObj.GetRequestStream().Write(buffer, 0, buffer.Length);
                reqObj = null;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from
I have a asp.net-mvc website with a SQL server backend (using nhibernate for OR
I'm trying to delete a database record using ASP.NET MVC, Fluent, and NHibernate. See
I'm using ASP.NET MVC + NHibernate + Fluent NHibernate and having a problem with
I'm using ASP.Net MVC (still 1.0 for now) with Castle ActiveRecord and NHibernate.Linq. All
I am currently developing a site using ASP.NET MVC 3, I am using Nhibernate.
I have a ASP.NET MVC application using NHibernate and the application runs fine when
I am using NHibernate/Fluent NHibernate in an ASP.NET MVC app with a MySQL database.
I am using NHibernate to as the Data Access layer for my ASP.NET MVC
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.