FilenotFoundException (Access Denied) on windows
I have an intranet web application from which I am trying to access files on a windows network share. I have a domain userid and password of an account that has access to the files, but I do not wish to permanenty map a drive to the location of the files, I "merely" wish to provide the credentials at the time I try and access the files. The best I can do at this stage is get a FileNotFoundException (Access Denied) trying to use a URLConnection. Does anyone know if/how this can be done?
thanks
[510 byte] By [
halibuta] at [2007-10-1 16:12:55]

I ran into the same problem too. It appears you may be able to do something with JAAS, but I'm not familiar with it. I eventually gave up and wrote JNI code using C++. Using the Windows API ImpersontateLoggedOnUser and RevertToSelf allow you to associate an NT account to the current process and gain access to the file. The biggest pitfall is that obviously, using JNI with windows API, you just lost portability.
You might also consider using the open source code project jCIFS. It's quite useful.
http://jcifs.samba.org/
It's all pure java