Bala
Bala

Reputation: 277

Uploading file in mapped drive using asp.net

I have two servers. Application server and File server. I need to upload files directly to File server.so far what i have done is, when i upload i received "unknown user name and bad password error" .so i created an user name and password in file server like in the Application server (IUSR_ account. exact like in the application server). Now i receive "System.UnauthorizedAccessException: Access to the path \xxx\xx... is denied".Then i granted the network service user as full permission in File server shared folder. still i get the UnauthorizedAccessException. And one more, the application pool is running under the identity of network user. Help needed. Thanks in advance...

Upvotes: 0

Views: 2038

Answers (1)

Anders Abel
Anders Abel

Reputation: 69260

Are the machines part of the same domain? In that case you give the machine account (called machinename$) of the app server access to the file server. Then you run the app server app pool under the "network service" account. You also have to access the file server with a complete unc path (\\server\share\directory) as mapped drives are tied to a specific user.

If you're not in a domain environment you need to add code so that the app server logs on to the file server when attaching the network share. Having the same username/password pair on both the client and server is something that works magically when logging on interactively, but for services that is not an option.

Upvotes: 1

Related Questions