473,405 Members | 2,141 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 network share

30
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 log file, but i do not wish the user who is running the application to see the share or the log file, i ahve played with an oledb connection but it kept complaining about workgroup information being missing.

Here is my code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. '''insert some kind of connection string here
  3.  
  4. Dim writer As New StreamWriter("" & fileloc & "" & nbkname & ".txt", True)
  5. writer.WriteLine("" & tmpuser & " Opened Drive Mapper at " & dateTimeInfo & "")
  6. writer.Close()
  7.  
  8. '''close the connection
  9.  
the first line (just so you know what the code is doing) is saving to a file in a location set by the varaible fileloc and filename 'nbkname' .txt

if anyone can help it would be much appriciated!

Jay!
Jul 3 '08 #1
5 1411
DrBunchman
979 Expert 512MB
Hi there,

Could you not give the username that your application is running under permission to access this share? That way the user would not be able to access the share but your application could.

Dr B
Jul 3 '08 #2
Asprisa
30
im not sure if this is possible as it will be run locally on around 128 notebooks, i want to obvisouly make as little work as possible for myself and anyone else who works on this project in the future. Is this possible the way you talk about?
Jul 3 '08 #3
DrBunchman
979 Expert 512MB
Is this a website or windows app you're talking about?
Jul 3 '08 #4
Asprisa
30
Sorry it is a windows app
Jul 3 '08 #5
Asprisa
30
i just came across this code i will try this and let you know what happens.

Expand|Select|Wrap|Line Numbers
  1.  Dim imp As New RunAs_Impersonator 
  2. Try
  3. imp.ImpersonateStart(DomainName, UserName, Password) 'creates new context using token for user
  4.  
  5. Add code to run as UserName here 'everything between ImpersonateStart and ImpersonateStop will be run as the impersonated user
  6.  
  7. imp.ImpersonateStop() 
  8. Catch ex As Exception 'make sure impersonation is stopped whether code succeeds or not
  9. MsgBox(ex.Message)
  10. imp.ImpersonateStop()
  11. End Try 
  12.  
Jay!
Jul 3 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: ysrana2001 | last post by:
In my office we have two SCO OpenServer (TM) Release 5 servers with two different terminals network. Now we have to join both server and windows server to share some file. Before we use generally...
5
by: JohnFol | last post by:
I am using the Win23 API WNetCancelConnection2 and can sucessfully make a connection to a share within my class. The class is called from a Windows Form based test harness. When I instantiate...
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...
1
by: brian.oneil2 | last post by:
Is there a way to install this onto a network file share and allow a team to access it? I would say share a CD from a networked CD drive, but there are multiple CD's that would have to be inserted....
4
by: Matt Dockerty | last post by:
Hi, I'm trying to connect to a network share using a username / password / domain of my choosing. I've tried the WindowsIdentity.Impersonate route but can only impersonate the users on the...
3
by: musosdev | last post by:
Hi guys Okay, I've setup my projects to open and compile fine in VS2005 using FPSE and remote web, but it's *really* slow. So I thought I'd have a go at doing it the normal way, by loading from...
4
by: Jeremy S. | last post by:
We're in the process of writing a new Windows Forms app and the desktop support folks want for it to be run from a network share. I know it's possible (i.e., just have the framework on the clients...
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...
4
by: duffaz | last post by:
I am trying to I am trying to connect to an SQL Server using a vb.net program. It works if I put it on the SQL Server computer, but will not connect over my local network that is set up as 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...

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.