473,320 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Accessing a Share Using Windows Credentials

Using VB .NET how can I enable my program to access a share on another
machine and pass the user name and password. I have a computer and share,
say "\\computer\share" so I can copy files from it but to access it I have to
log on with a UserName and Password. I do not want the user to have to enter
the user name or password, so how can I pass this in code?

Thanks,
-Carl
Mar 17 '06 #1
3 8396
Carl wrote:
Using VB .NET how can I enable my program to access a share on another
machine and pass the user name and password. I have a computer and share,
say "\\computer\share" so I can copy files from it but to access it I have to
log on with a UserName and Password. I do not want the user to have to enter
the user name or password, so how can I pass this in code?

Thanks,
-Carl

Is the username/password on the remote computer the same as the user
running the VB program? If it is, it should pass the credentials
automatically. If it is not, adding the user to the remote computer
using the same password should fix it. Otherwise you will have to
impersonate a user in the vb.net program.

Chris
Mar 17 '06 #2
The username/password are not the same as the user running my program so I do
need to use impersonation. How do I do that and then access a file on that
other computer using the impersonated windows account? Is there some sample
code that does this I could look at?

Thanks,
-Carl

"Chris" wrote:
Carl wrote:
Using VB .NET how can I enable my program to access a share on another
machine and pass the user name and password. I have a computer and share,
say "\\computer\share" so I can copy files from it but to access it I have to
log on with a UserName and Password. I do not want the user to have to enter
the user name or password, so how can I pass this in code?

Thanks,
-Carl

Is the username/password on the remote computer the same as the user
running the VB program? If it is, it should pass the credentials
automatically. If it is not, adding the user to the remote computer
using the same password should fix it. Otherwise you will have to
impersonate a user in the vb.net program.

Chris

Mar 17 '06 #3
Carl wrote:
The username/password are not the same as the user running my program so I do
need to use impersonation. How do I do that and then access a file on that
other computer using the impersonated windows account? Is there some sample
code that does this I could look at?

Thanks,
-Carl

"Chris" wrote:

Carl wrote:
Using VB .NET how can I enable my program to access a share on another
machine and pass the user name and password. I have a computer and share,
say "\\computer\share" so I can copy files from it but to access it I have to
log on with a UserName and Password. I do not want the user to have to enter
the user name or password, so how can I pass this in code?

Thanks,
-Carl

Is the username/password on the remote computer the same as the user
running the VB program? If it is, it should pass the credentials
automatically. If it is not, adding the user to the remote computer
using the same password should fix it. Otherwise you will have to
impersonate a user in the vb.net program.

Chris


Once the impersonation is done you should be able to access shares just
like you wanted to.

Do a web search for impersonation, I haven't had to do it in a long time
so I don't have any code for you. There are lots of examples around,
most will deal with ASP.NET, but the process is identical.

This article looks promising, they've made a wrapper for doing the
impersonation.

http://weblogs.asp.net/ralfw/archive.../24/39479.aspx

Chris
Mar 17 '06 #4

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

Similar topics

23
by: Lamberti Fabrizio | last post by:
Hi all, I've to access to a network file from an asp pages. I've red a lot of things on old posts and on Microsoft article but I can't still solve my problem. I've got two server inside the...
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...
3
by: Bonj | last post by:
I need to write a windows service, and the only way it can access a shared drive on a file server on the network is if the installer is put in "User" mode - "LocalService", "LocalSystem" and...
0
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or...
11
by: Andre | last post by:
Hi, I have ASP.NET application running on standalone (not part of the domain) Windows 2003. I use forms authentication for my application. The problem I have is that I need to create and read...
5
by: Khalique | last post by:
Hi everyone, I Hope that someone will be able to give me a hint to the solution to my problem. I have developed a web service (vb.net) that needs to access the folders / files and copy files to...
4
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For...
1
by: riyaz.shaikh | last post by:
Hi All.... I am having a web site which runs under Windows Authentication. the requirement is this application should write files to a folder share. but the problem is this folder share is...
1
by: Usenet User | last post by:
From a .NET 1.1 app: need to access a file share on a remote server by its UNC path, i.e., \\server\folder\subfolder\, using specific username and password. The problem is that the credentials...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.