Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to move uploaded file to remote server

Status
Not open for further replies.
Jul 28, 2011
167
NG
Hi again,

Hope I'm not asking too many questions?

I'm using vs2008 I need to upload a file to a remote server.
there is a folder called file on my site and I'm supposed to move all uploaded files there.
Currently, when I use the myFile.PostedFile.SaveAs() method, all works well locally. But when I upload to my remote server, there goes the issue.

I have given the folder appropriate permissions, but myFile.PostedFile.SaveAs() seems to always see my lodal directory

here it is:

Dim dirPath As String = AppDomain.CurrentDomain.BaseDirectory + "Files"
'myFile.PostedFile.SaveAs(dirPath & "/" & strFileNameOnly).

Any help appreciated

____________________
Men put up a strong face just to cover their weaknesses...good!
But a smile makes them live longer....
Which would you choose?

Think about it.
 
the problem is network authorization. everything works locally because the client and server are the same machine and the local web development server is running under your credentials.

when deployed to a server IIS and asp.net run under the local server/system account which is highly restrictive.

there are a number of different approaches you can take. if you want the website to do all the work, you need to
1. enabled windows authentication, or run the site as an authenticated user
2. assuming a Windows network: enable delegation in Active Directory from the web server to the remote server.

#1 passes your local credentials to the web server. or, if you are using a single impersonated account, makes the website run under a specific user's account.
#2 then passes the impersonated account from the website to the remote server.

this is all by design to decrease the chance a hacker could gain control of the server and infiltrate the network.

another approach:
have the website save the files locally within the root directory somewhere. then have a windows service with elevated privileges that copies files from the website's directory to the remote directory.


Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top