Hi all,
I have to create file share network folder,my code is:

Dim fs As New FileStream("\\<machine1>\Sharefolder\file.prm", FileMode.Create)


windows authorization have done before,and i have full control permission on that folder.
with this Code, i get this error :
Logon failure: unknown user name or bad password.
How can I do this ?
Thanx

Recommended Answers

All 11 Replies

Hi- You have this posted in ASP.NET, so I am assuming it is a web application.

Let's simplify this a little, because obviously the permissions are giving you some trouble.

I would suggest an easy work-around. Map a network drive to the folder. Let's say the Z: drive. (Right click on the folder in Windows Explorer and click 'Map Network Drive'.)

Try writing a file from the server to the folder using the credentials specified in IIS. If it works, you are in business. YOU MAY NEED TO ADD THE IIS USER TO THE FOLDER.

The change \\machine with Z:\.

Hope it help.

stenson1 at gmail

Hi,Thanx a lot for Your respond.
My project is vb.net Web Site.
Your solution doesn't help,and I've that error yet.

Vb.NET is the only code I write...

any one can't help me ???

Can you post the exact error you are getting? When it breaks on IE it should show you something along the lines of DOMAIN\IIS_USER is not authorized to access the file.

You need to make sure on the network resource/folder you are trying to access, the user specified on the exception has access. Try granting "Everyone" full control to the folder.

Is the machine on the same domain? Is there even a domain, or is it just a workgroup?

Have you tried impersonating a different user? (Just google it)

I've posted error later ???!!!
Logon failure: unknown user name or bad password.
and Everyone has full control access to this folder.
and all machines are in Workgroup.

make sure in the SHARING SETTINGS (not security settings), that CHANGE FILES is enabled... in SHARING not SECURITY. By default, it is just READ ACCESS.

Also, can you try mapping a network drive and writing to the network drive instead of the share path?

I've said that before !!!
it doesn't work .
do You yourself test it?

i write across the network all the time...

did you look at the shared settings of the folder?

also, AFTER you map the network drive
can you please try just pasting a file through windows explorer into the folder and see if that works?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.