|
Well im quite lost for a solution without a linux share to test with. I assume you have tried passing the domain name, if not in a domain, try passing the machine name, or try not passing the domain and setting the username to "machinename\username"?
- aejw.com
|
|
|
|
|
Hello I have caught the CNEtworkdrive class in an web application, i use the same code that you in a aspx button but do me nothing,Do you Know what is the problem.Thanks and best Regards
|
|
|
|
|
Is this work on Windows XP Home?
Hugo Tomas
|
|
|
|
|
Yes it should...
- aejw.com
|
|
|
|
|
How you install the program?
|
|
|
|
|
This is an code sample, not an application... You could however should you wish, get Microsoft Visual Studio.net, compile the application, use NSIS or Install Shield, etc to package the application into an installer and then install it.
There are applications about which are installable applications for network drives. One application even uses my code todo this, its called NetPlace (Network Place Manager) http://sourceforge.net/projects/netplace/[^].
(aejw)
modified on Friday, June 20, 2008 5:39 AM
|
|
|
|
|
How do I handle the below exception when I call MapDrive?
Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.
|
|
|
|
|
You have the following options....
1. Disconnect your previous connection to the resource first
2. Have your code use the same username and password as your previous connection
This error comes from Windows and as far as I know, there is no way around it.
(aejw)
|
|
|
|
|
To gain one more mapped drive, connect it to the IP of the server not the name
and to gain another one too, give your DNS an alias and connect throught the alias not the server name
Check this
http://support.microsoft.com/kb/173199/[^]
Hope this help
|
|
|
|
|
Thanks to aejw's work. I usesd it in my project, but unluckly my testers found it failed to map for one time and they could not reproduce it any more. It said the user has already mapped a network dirver for the same path. What a pitty!
I think maybe it will be perfect if the function WNetGetConnection is added to detect whether that network path has been mapped as a driver or not.
modified on Sunday, March 16, 2008 10:37 PM
|
|
|
|
|
Sorry... I have been meaning to update this code (when i get the time) from my site (http://www.aejw.com/) where there is a later version posted. Should it not fix the issue with the later version, it sounds like a logic fault from the calling application... You should read back if the drive is in use or try using "try{ }catch{ }".
(aejw)
|
|
|
|
|
This would be really great !
I'm looking forward to it.
Will this also be done on version on your site VB and C# ?
If help is needs, just yell
|
|
|
|
|
No problem , yes the new version will come in two flavors / articles... c# and vb.net, Each will cross link to show how c# vs vb.net API writing is compared...
and thanks, any testing will be a great aid...
(aejw)
|
|
|
|
|
Hi,
I still have your email and did not respond on it yet, I'm very sorry for that.
You said you already have a good ammount of code for the webdav part.
How far are you at the moment ?
I'm very exited about it !
Thanks.
|
|
|
|
|
I'm not able to map a http(s) drive yet, the rest works fine on the C# version from your site.
What happen is that I get the following:
Cannot map drive !!
Err Msg: No Network Provider Accepted the Given Network Path
OK, using net use on the commandline I get an 67 error, but I think this has nothing to do with it ?
|
|
|
|
|
Off the top of my head connecting a web drive needs an alternate set of API commands to be used... I am updating the class and article soon (next week or so). I will look into including this functin.
(aejw)
|
|
|
|
|
Hey,
Great code, truly was a big help for me.
Just a quick question, I'm using this code in my windows service and when my service returned an error saying the file I was trying to read was already in use by another process, I stopped my service and tried again an hour later.
When I restarted the service I got the following error:
"The local device name is already in use."
So I tried to Unmap the drive but it return this error:
"This network connection does not exist"
I was wondering if there is a work around for is...
Also the drive letter only does not work with your code, I have been able to suucessfully map to that drive letter through NetUse, and window's map network drive without issues.
|
|
|
|
|
Ok the lastest version of my class is on my site, aejw.com... This version is a little out of date, I am updating it in the next week or so. Thanks for reporting any bugs, I will do my best to sort them all out.
As for your service, it sounds like another application is maybe accessing / using a driveless "use" connection??? im not so sure. Try unmapping the share, using null as the drive value.
Please keep me posted, I really should also look into writing a demo service application (there are some ways of re-routing a service to load under a local user account).
(aejw)
|
|
|
|
|
Hi,
I am actually using your newest verison of this code, from your website.
Also, I tried unmapping using null as the drive value, but I still got the same error.
I then followed through the drive letters effected and found no other programs accessing set drive letters, or a program using a driveless connection. So, I tried using the force command on the mapping function in hopes it would go through but had no such luck.
Thanks for the response, I guess I'll just use a different drive letter, I mean its not that big of a problem for me cause the drive letters are still able to map using windows mapping.
oh one more question, is there a way of using this code to connect to the next open drive letter (say drives A:,B:,C:, and D: are in use, it than uses E:, much like the * in a Net use cmdline), if yes is there a way remembering that drive letter so it could be placed in a server log message
Andrew
|
|
|
|
|
Thank you, Thank you, Thank you!!!
I've been searching for a way to get my service to read from a mapped drive
for a few days now!! This is exactly what I needed!!
|
|
|
|
|
Unmapping a network drive that is not bind to a local drive will fail whereas the class allows the mapping of a network drive without assigning it to a local drive.
To make it work, update the zUnMapDrive() :
<br />
int i;<br />
if (ls_Drive != "")<br />
i = WNetCancelConnection2A(ls_Drive, iFlags, Convert.ToInt32(pfForce));<br />
else<br />
i = WNetCancelConnection2A(ls_ShareName, iFlags, Convert.ToInt32(pfForce));<br />
A new version of this class that already has the fix and more features can be found here[^]
- Daniel B.
-- modified at 12:01 Monday 18th June, 2007
|
|
|
|
|
I'm sorry I really should update this article... I will get it done soon.
|
|
|
|
|
I have to Thank you a lot.
|
|
|
|
|
|
If you want to write an application in VB.NET you get errors that the namespace cannot be found. Adding a reference to networkdrive.dll does not work. I compiled the class to a new DLL which can be referenced to in VB.NET projects. Enjoy it!
http://rapidshare.com/files/7669042/NetWorkDrive.dll.html (will be deleted by rapidshare if not downloaded for 45 days)
|
|
|
|