Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am a c# developer running in to issues with a program of mine that tries to transfer files on to a shared folder on a computer which is on a different domain. i.e my windows service sits on domain 'X' and the shared folder is on domain 'Y'. I am trying to map the folder on to Domain 'X' in my program using the "net use" command. and I am getting a "network not found" error. I am guessing this is because the shared folder is on domain "Y" and domain X has issues while trying to connect to a computer on domain Y. The net.exe command works perfectly with shared folders inside of domain X. Is there a way i can work through this issue. My only option is to map a drive on to my hosting computer programatically. I would highly appreciate any help on this issue since i am out of ideas :(

Thanks Karry

UPDATE: Got it working. I had to remove an extra backslash from the end of the shared folder name in order to get it to work from my c# service. That backslash ate up my day...Sorry guys. it turns out to be embarassing for me now.

share|improve this question
    
Windows services are not allowed to map drives. –  mailq Sep 19 '11 at 14:54
    
@mailq: That's not strictly true but, in general, I'd highly discourage any architecture for a service that involves "mapped" "drives". –  Evan Anderson Sep 19 '11 at 16:00
    
Thanks All..for the help and suggestions. It turned out that the shared folder name was the cause of getting the "network not found" error. I had to remove a "\" from the end of it to get it to work from my c# program. –  karry Sep 19 '11 at 19:15

1 Answer 1

Can you give more information on what errors you are getting? Most probably if it's not a connectivity issue (ping,logon to the other domain) it might be a security issue where programmatically you would have to impersonate another user or make sure that the user that executes your program has sufficient priviledges

P.S. since I don't have enough rep to add a comment; mailq why windows services are not allowed to map network drives?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.