You need to have two server FileServer and WebServer. You also need admin rights for both the servers. In both the server you have to create a user with the same username and password. Lets say, UserName : TestUser, Password = pwd. Now in IIS you have to Edit permissions of your Website as shown below.
Now implement impersonation in Asp.Net as shown below.
1. Could not load file or assembly or one of its dependencies. Access is denied.
To fix this you have to add permissions (newly created User's) to the "Temporary Asp.Net folder"
Location of Temporary Asp.Net folder is -
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
2. Logon failure: unknown user name or bad password
If you get this error make sure that the username and password of both the servers are same and you have added impersonation feature in webconfig. In the code behind you can use the below code to save the file in the remote server...
protected void UploadButton_Click(object sender, EventArgs e)
string filename = Path.GetFileName(FileUpload1.FileName);
//FileUpload1 is the id of file upload control
FileUpload1.SaveAs(@"//YourComputerName/TestFolder" + filename);
//To show the status of File
StatusLabel.Text = "Upload Status: File Uploaded";
catch (Exception ex)
StatusLabel.Text = ex.Message
Please Like and Share the Blog, if you find it interesting and helpful.