We help IT Professionals succeed at work.

Storing a file on a fifferent server

dotnetuser07
dotnetuser07 asked
on
Medium Priority
259 Views
Last Modified: 2013-11-07
Hi,
 
    I have a question regarding Storing a file on a different server.
I need to write code for uploading files like Tiff, jpg(images) etc. I am thinking to use File upload control for this. With file upload, the file will be uploaded to the server(Prod) which has the code. But i need to store those files on a different server.
I am new to this ASP.Net  What do I need to do for this kind of stuff.

Thanks in Advance.
Comment
Watch Question

Top Expert 2013

Commented:
Never did on seperate server but.. try this:
With FileUpload SaveAs Method passing the full path where the file needs to be stored.
And the account under which the file will be written to that server should have access and write permission to that server as well as to the directory in which the file is uploaded.

Check this: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.saveas.aspx

Author

Commented:
OK Thanks. This is a web application. So, many people will be using this page to upload the files.
Every one wont have access to that server rite?. What in that case?
Top Expert 2013

Commented:
In most cases it should be Network/Service account if its Win2k3 server if you have not set
<identity impersonation=true /> in the web.config of your webapp.

Or you can set <identity impersonation=true  username="abc" password=xyz" /> where abc is an account which has access to your file server and has write permission to the directory.

although this is one way to go ... if it works :D

Author

Commented:
Thank you so much. Is there any sample code to look into?  Becasue i am unable to access the path to another sever?..
Top Expert 2013
Commented:
Sorry I don't have any sample code...
I did not try using fileUpload SaveAs method to transfer files on different server. So not sure if it allows that. If that does not work ... other option would be..

1: Use FileUpload Control to upload file on the WebServer where your web app is running
2: Write some service that runs periodially or depending on your need to copy the files from WebServer Directory to your Another Server.

If something else pops up ... i will let you know.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.