473,466 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Connecting to network shares

I have some code working that uses the API WNetAddConnection2. The code is
used from a Windows Form and on my PC it works. If I package the code and
deploy to a server the code fails with an error

"The following exception has occured: Unable to connect network drive. Win32
error code is: 67 (The network name cannot be found.)"

This is when I am logged on as the administrator of the local machine. I
thought it might be the fact I am not authenticated by a domain (whereas on
my PC I am). However, if on that machine I do a simple Start\Run and enter
the exact same IP\Share name I get prompted for the Username / password.
When entered as per the WNetAddConnection2 parameters I can see the files
without problem.
So, I am really getting stuck for ideas.
PS I did try this a few days back as a Windows Service and had "other"
problems, hence why it's now a Windows Forms exe.
Nov 21 '05 #1
2 4313
Hi,

Maybe this will help.
http://www.dotnet247.com/247referenc...28/144136.aspx

Ken
------------------
"JohnFol" <Ou************@WibbleObbble.Com> wrote in message
news:DS*****************@newsfe2-gui.ntli.net...
I have some code working that uses the API WNetAddConnection2. The code is
used from a Windows Form and on my PC it works. If I package the code and
deploy to a server the code fails with an error

"The following exception has occured: Unable to connect network drive. Win32
error code is: 67 (The network name cannot be found.)"

This is when I am logged on as the administrator of the local machine. I
thought it might be the fact I am not authenticated by a domain (whereas on
my PC I am). However, if on that machine I do a simple Start\Run and enter
the exact same IP\Share name I get prompted for the Username / password.
When entered as per the WNetAddConnection2 parameters I can see the files
without problem.
So, I am really getting stuck for ideas.
PS I did try this a few days back as a Windows Service and had "other"
problems, hence why it's now a Windows Forms exe.

Nov 21 '05 #2
Hi Ken, thanks for the pointer.

If I use a made up username / password I get a boolean True for the
LogonUser function, but get a ret value of 126
If I continue to step through I get a "New Identity" of "Guest" under a
local machine.

I need to check the domain for the account I use to connect with before
trying "for real", but many thanks for the assistance.


"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:um**************@tk2msftngp13.phx.gbl...
Hi,

Maybe this will help.
http://www.dotnet247.com/247referenc...28/144136.aspx

Ken
------------------
"JohnFol" <Ou************@WibbleObbble.Com> wrote in message
news:DS*****************@newsfe2-gui.ntli.net...
I have some code working that uses the API WNetAddConnection2. The code is
used from a Windows Form and on my PC it works. If I package the code and
deploy to a server the code fails with an error

"The following exception has occured: Unable to connect network drive.
Win32
error code is: 67 (The network name cannot be found.)"

This is when I am logged on as the administrator of the local machine. I
thought it might be the fact I am not authenticated by a domain (whereas
on
my PC I am). However, if on that machine I do a simple Start\Run and enter
the exact same IP\Share name I get prompted for the Username / password.
When entered as per the WNetAddConnection2 parameters I can see the files
without problem.
So, I am really getting stuck for ideas.
PS I did try this a few days back as a Windows Service and had "other"
problems, hence why it's now a Windows Forms exe.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Homer Blankenship | last post by:
Every day we get several errors like or similar to this one while a ..net app is trying to write files to a network share. The .net app breaks the files up into chunks and writes them to this share...
36
by: Thomas | last post by:
after spending countless hours trying, i give up and hope to get some help in here. on server1 i got the web myweb.com with my test.asp. in the test.asp, i'm trying to read a file from an UNC...
6
by: Default User | last post by:
Hi How can i look for network share folders and copy a text file to it? I've been looking into how i can do this in the documention but with no luck. I found a little on of the web but i dont...
5
by: Josh Rolfe | last post by:
I have a page in classic asp that accces a network drive, The code is as follows: <% dim fso dim objFolder set fso=server.createObject("Scripting.FileSystemObject") set...
2
by: Michael | last post by:
We have an ASP.NET 2.0 web application running on a Windows 2003 domain controller. Part of that application needs to read and write files from and to a network share ( living on a MAC Xserveraid)...
6
by: tendim | last post by:
G'day group. Currently our organization us using VB6 based applications, and I am trying to push forward and migrate some of the smaller things to VB.NET, eventually migrating all applications...
0
by: NoWhereMan | last post by:
Hello, I'm trying to get the list of shared folders of a network computer and add them to a combo box. I'm using the bellow code in VB .NET. Code ==== Private Sub EnumShares(ByVal Machine As...
5
by: lmttag | last post by:
ASP.NET 2.0 (C#) application Intranet application (not on the Internet) Using Windows authentication and impersonation Windows Server 2003 (IIS6) Server is a member server on a domain Logged...
3
!NoItAll
by: !NoItAll | last post by:
I have scoured Google to find some examples - but they are either completely cryptic (I'm not afraid of Windows APIs either) or don't seem to work. I want to build a list of available shares from my...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.