How to access remote file of other domain?
843790Nov 30 2009 — edited Jan 27 2010Hi All,
I want to access a remote file which is in another domain. Following is the environment (all Windows machine):
Following two domains have been created
1. Domain1: test
* user: abcuser
* Shared folder: abcuser
o Share Rights: Full Control for Everyone
2. Domain2: abc
* user: testabc
Now I want to upload a file at shared folder abcuser (Domain1) thru my application which is running on a machine in Domain2 where I launch the application thru services. For uploading the file I am simply creating a FileOutputStream by specifying the shared path to its constructor.
Following are the cases when the upload works i.e
* When the shared location is in the same domain and
* Change the user with which my application start from Local System account to the domain account.
Now, I want to know is there any way by which I still launch the application from Local System account but provide the user credentials (userName/pasword for Doamin2 user) at runtime to allow access to the shared location. I tried it thru the usage of File and FileInputStream but it dint work as java.io.File takes URI with undefined authority (i.e. If I specify username:password it throws exception).
Can anyone suggest me any other way.