473,405 Members | 2,279 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,405 software developers and data experts.

Connecting to a file share in C# - HELP

I want to be able to connect to a file share in C# given a username
and password.

Any help would be appreciated. Code examples welcomed

May 21 '07 #1
3 6012
Hello BillGatesFan,

There are 2 solutions
1) Using Win32 API to create logon session "LogonUser" method
2) using Win32 API WNetAddConnection3

Google for sample http://groups.google.com/groups/sear...ss+credentials
---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

BI want to be able to connect to a file share in C# given a username
Band password.
B>
BAny help would be appreciated. Code examples welcomed
B>
May 21 '07 #2
On May 22, 12:17 am, Michael Nemtsev <nemt...@msn.comwrote:
Hello BillGatesFan,

There are 2 solutions
1) Using Win32 API to create logon session "LogonUser" method
2) using Win32 API WNetAddConnection3

Google for samplehttp://groups.google.com/groups/search?q=dotnet+file+share+pass+crede...

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog:http://spaces.live.com/laflour
Team blog:http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

BI want to be able to connect to a file share in C# given a username
Band password.
B>
BAny help would be appreciated. Code examples welcomed
B>
How to call garbage collection in C# programming?
need some help

May 22 '07 #3
First - the important question is "why?"; as a general rule, leave it
alone - it knows what it is doing.

However: GC.Collect() may do the job, but nothing is guaranteed.

Marc
May 22 '07 #4

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

Similar topics

2
by: Tyler Sample | last post by:
I've got a Samba share set up on a LINUX box. It's set up for user-level access. A Windows user is mapped to a UNIX user. When accessing through file explorer, a username/password box pops up,...
1
by: lhansen | last post by:
I've seen posts similar to this, but have not found the magic bullet to solve my problem.. I have an asp page (see source code below) running on IIS 6.0 on Win2003 Server that tries to get file...
3
by: N.K. | last post by:
Hi, I've just installed postgres on the Linux server. It is supposed to start automatically which I think it does since I can run an sql stmt right away. When I'm trying to connect from a remote...
1
by: Dishaa V | last post by:
Hello I need to connect to an access db which is on the internet. I do know that URL of the same. its http://www.vallury.com/balance/bank.mdb. Its just a test db. How can I connect to that db...
4
by: BravesCharm | last post by:
I am trying to connect to SQL Server 2005 Express with Visual C# 2005 Express using this code: static void Main(string args) { SqlConnection conn = new SqlConnection(@"Data...
1
by: scottrm | last post by:
We have multiple developers all using a shared development server. Recently we have migrated to a new server. I copied all the project folders across and created virtual directories mapped to and...
11
by: CM Manager via DotNetMonster.com | last post by:
I am very frustrated due to this exception error I am receiving. I've tried searching numerous user support groups, Microsoft Support Net, Google, etc. and haven't found exactly my situation....
5
by: Jeff Richardson | last post by:
I am creating a web service that returns data from an Access 2000 database using VS2005. The Access database is located on a different server than where the web service is running. The Access...
5
by: Asprisa | last post by:
hi guys, i was wondering if there is a way to connect to a server share that requires a username and password without mapping it as a drive, what i wish to do is open a session so i can save a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.