How To Access Network Drive Through Usual System.IO Classes

Feb 28, 2010

My software handles multiple operations on files, and I have now finished writing the related functions, using the System.IO classes. I now need to add support for network drives. Using a mapping works very well (although Directory.GetFiles is a bit low, and I don't know why), but I'd now like to be able to deal directly with paths such as \192.168.0.10Shared FolderMyDrive. Is there any way to handle this type of paths other than mounting the drive to an available drive letter, using the newly generated path, and then unmounting?

View 4 Replies


ADVERTISEMENT

Mysteriously Lost Access To A Mapped Network Drive?

Aug 5, 2009

I had a basic text file reader/writer program that wrote and read from a mapped, shared drive up and running for a couple weeks. I wanted to add just a couple more things that shouldn't have effected the program (the ability to write another text file), and now the program can't find the shared drive. The error I get is: Could not find file '<file location>' with <file location> filled in with either the mapped name of the drive (X:) or the unmapped name (\servercomputer). Both are copied directly from windows explorer, so I know the path is right. I'm a bit of a beginner, but I'm pretty sure that all the required permissions are in place, and all users have access to this drive.

To further complicate things, it is not consistant. Some commands appear to have no trouble reading off the mapped name, but don't read the unmapped name, and vice versa. Others won't take either. Sometimes the code will execute perfectly up to the middle of the code (accessing the shared drive a couple times), and then it will give this error. If anyone could point me in the right direction,

View 1 Replies

Determine If A Drive Is Local Or A Network Drive?

Dec 10, 2008

Does anyone know if there is a way to determine if a drive is local or a network drive?

View 1 Replies

Compile DLL To Network Drive?

Aug 24, 2009

Compile DLL to network drive

View 1 Replies

Connect To A Map Network Drive?

Aug 30, 2010

I Have a batch file in a server in my network. I maped that shared folder (that batch file exist in it) every time that I want to run that batch file first I should have to connect to that network drive(with username and password) How can I do it in my code . I want to connect to that network drive by code in my form_load. I test codes below but it dose'nt work.

AppDomain.CurrentDomain.SetPrincipalPolicy(Princip alPolicy.WindowsPrincipal)
Dim idnt As New WindowsIdentity(username, password)
Dim context As WindowsImpersonationContext = idnt.Impersonate

View 3 Replies

How To Get UNC Path Of Network Drive

Jul 10, 2009

I am using some like following code to get UNC path of drive letter.
Dim query As New System.Management.ObjectQuery("select * from Win32_LogicalDisk")
Using searcher As New System.Management.ManagementObjectSearcher(Query)
'loops for all drives on system
For Each Mgmt As System.Management.ManagementObject In searcher.Get()

And it was working but now it is giving error. Below is error with stack trace
{"Specified cast is not valid."}
at System.Management.ThreadDispatch.Start()
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()

I also want to know alternative way to get unc path of drive that is also not depend on windows API. As there is a class driveinfo to get all drives (including network) on system. Is there any class that also provide complete or unc path information of Drive.

View 6 Replies

Mapping A Network Drive?

Aug 16, 2011

I've followed the instructions found at the letter (albeit also adding the parameters to pass a username and password), but have had no success connecting to a network drive that requires authentication to access.

View 8 Replies

Searching Network Drive?

Sep 2, 2011

I'm working on a program that is used as a tool to quickly search & Open CAD drawings on our network. I have it working for the most part, but it is very slow. Right now I have an ini file with the path to the Directory I want to search for Example "G:" I think the reason this is so slow, is because there are other folders in this directory that don't need to be searched. My idea is to add all of the paths I want the program to search in the ini file, but I don't know how I will have it search through this using vb code

want my ini file to look like this

G:A
G:B
G:C
G:E

So directory D would not be searched by the program because its not in the list.

MyCode
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim PathReader As IO.StreamReader
PathReader = IO.File.OpenText("C:ISOExplorerPath.ini")

[code]....

View 10 Replies

Turn On Network Drive?

Mar 27, 2009

i have a network drive mapped to z each time i turn on the pc that drive is disconnected but i can see the z letter and if i click they return, there is some way to active that letter/drive but vb.net?

View 1 Replies

Map A Network Drive Over A Windows Service?

Mar 2, 2010

How can I map a network drive over a Windows Service. What I did until now.

Using the Shell command. -> not working.

vb.net

Shell("net use \" & My.Settings.ParaRootPath & " " & My.Settings.ParaPasswordHTTPS & " " & "/user:" & My.Settings.ParaLoginHTTPS)

Using a System.Diagnostics.Process object. -> not working

vb.net

ShellExecute As New System.Diagnostics.Process
ShellExecute.StartInfo.RedirectStandardOutput = True
ShellExecute.StartInfo.FileName = "cmd.exe"

[Code].....

If I run the application as normal application, it is working correctly.

View 2 Replies

DB/Reporting :: Saving To Network Drive?

Mar 29, 2008

How can I save a file to a folder on a network drive. I have the drive mapped on my pc as "G:" but someone else could have it mapped as "Q:" or something. I can save if I use "G:ServerNameDriveNamefolder"; but can't from another pc unless I change the code to what the drive is mapped to on that pc.

Here is the code I'm trying to use to direct to the folder with out using the mapped drive:

Code:
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
FileOpen(1, "\ServerNameDriveNameFolder" & filenamec.Text, OpenMode.Output) 'location of the file.

View 1 Replies

Deploy .msi File From Network Drive?

Jun 30, 2009

I have developed a visual basic app in Visual studio 2008. I have created a windows installer file. Can I deploy this on a network drive and does .NET framework have to be installed on server? The application has a MS access database associated with it, so I would like to have it backed up via the network.

View 1 Replies

Get / Set A Mapped Network Drive Label

Apr 4, 2009

I am working on a win application that maps/unmaps network drives. And i have a couple of problems getting and setting a mapped network drive's label /name. The driveinfo volumelabel property will get or set the label of the remote drive/folder, what i need is the mapped network drive name/label on the local system. it then adds the driveletter, volumelabel, and connection state to a listview.

[Code]....

View 1 Replies

Get Folder Rights On A Network Drive?

Sep 2, 2010

I want to know what rights the user has for a given folder on a network drive. But I can't find anything that does just this.

I have used DirectoryInfo.GetAccessControl and DirectorySecurity.GetAccessRules, etc. to get a collection (AuthorizationRuleCollection) of rules. But that gives me all the access groups and their rights. I don't need that (I guess I can see if I can find code that gets which returns the security groups for the current user and then compare those to the collection, but this seems awkward.)

Or I can write code that tries to create a file, delete it, etc. which is easy to do, but not quite accurate (if the user can't create a file, how can I see if the user can delete one, if the user has create, but not delete rights, I get a bunch of temp files, etc.)

All I need to know is if the current user has read write, read only, create, and/or delete rights to a given folder (and I guess file might also be nice - I would assume similar code.)

I have to believe that its a really simple thing. But Googling it and searching on the forums here didn't turn up much (unless I want code to change the users rights - which I don't.)

View 1 Replies

Getting Address Of A Mapped Network Drive

Mar 28, 2010

my first question on this board. I'm creating a media player(Like so many others). I try playing files over my network. When I pass this address "M:songssome artistsome song.mp3" to the windows media player control it actually opens "\ServerMEDIAsome artistsome song.mp3". But when my program checks if it is playing the correct song it thinks it is not, because the strings aren't equal. Is there a way in VB to get the network address of a mapped network drive? I can already see that it is a network drive but not wich address it points to.

View 2 Replies

How To Create A Folder In Network Drive

Sep 26, 2011

To create a dynamic folder in local drive it was generating, if suppose we need to create a folder in network path means error say that cannot access to the path is denied, how to resolve this issue , i m working on vb.net

View 1 Replies

Make Network Drive Ready

Mar 8, 2010

i have a NAS drive that is mapped to my system..My application will copy files to the drive but the only problem is the drive has a sleep function on it therefore when i try to copy files to it and it is in sleep mode, it says the folder does not exist (drive still in my computer but just with a red X on it)is there a function to make ir ready ? the only other way to do it is to double click the drive icon in my computer then it wakes up... but id rather not do this as its a pain.

View 3 Replies

Mapping Network Drive Remotely?

Feb 19, 2009

I'm developing an application that needs to Map a network drive for a domain user logged into a domain PC from a remote location. I have tried numerous different things with different levels of success but none with the required functionality. - First, I used WMI to create a process that would run Net Use with no luck: Net Use would ask for a user name and password to connect to the share instead of using the User's credentials.- Second I generated a script (wshNetwork) that would be copied to the remote PC and used WMI to once again create a process that would run wscript in command prompt to execute the copied script.

The script would run successfully (as evident by code placed to fill in a text file when the script completed) but the network drive was not added.- Third I created a program that would be copied to the user's PC which would map the drive using Windows Network API. Again, I used WMI to execute the program as a proccess with the results the same as the script. The application would run successfully but the drive was not added.- Fourth, I edited the user's registry to add the drive. This worked, however the mapped drive was not usable through Windows Explorer without a reboot.

Unfortunately, one of the requirements of the application is to avoid rebooting the remote PC.I have arguably had the greatest success with the following:- I used WMI to generate a scheduled task on the remote PC that would run a script (wshNetwork), an application (Win API) or the Net Use command to map the drive. All resulted in the drive being properly mapped and visable through windows explorer with the files accessable. However, the new map would be labeled "Disconnected Network Drive" and the drive could not be removed (error: network connection could not be found) and the driver letter could not be used without rebooting the system. Anyone have any suggestions on how I can do this? Unfortunately I can't use wshController to run a remote script because a majority of the PCs on the domain are not configured to use it.

View 10 Replies

Save Project To A Network Drive?

Nov 20, 2009

I want my high school students to be able to save their VB projects to their network drive folder on the school's fileserver. The students do not have access to the c: drive by Group Policy. VB does not even see the network drive each student has mapped. I have googled around and discovered it has to do with VB not trusting any network folders. There is a supposed solution by using the .net framework configuration tool but I had no success getting that to work. Right now I have them saving their project to their usb drives. They have a tendency to lose or forget those. Is there a simple way of getting those network folders accessable?

View 2 Replies

Saving Projects To A Network Drive?

Nov 23, 2009

I teach using VB. At the moment the kids are having to save their projects to usb drives because VB does not see the network folders on the fileserver. They lose the usb drives. The kids do not have access to the c: drive by Group Policy. How can I set up VB.net to see the their network drive folder?

View 2 Replies

Using Vs2005 And Put The Exe And Dlls On A Network Drive?

Sep 16, 2009

I have compiled my application using vs2005 and put the exe and dlls on a network drive. The users running windows 7 that don't have write access to the folder cannot run the program. The users on XP can run the program even without write access to the folder. The admins with write access to the folder can run it on both XP and windows 7. Does anyone know what I need to do to fix it other than giving the user write access to the folder.

View 1 Replies

Change The Path For A Network Drive Already Mapped?

Sep 16, 2009

We are getting a new server and we already have a Z: drive mapped, and we want to use the same letter and just change the path without touching all machines. I am looking for a simple VBscript to do that. I have one that will remove and one that will add, but I need to have on script.

View 1 Replies

Check If A Network Drive Is Mapped Persistently?

Oct 18, 2009

I use the following code to layout network drives on a system. I want to add a third column for persistence but in vb.net I do not know how to check if a drive has a persistent map or not.

For Each drive_info As DriveInfo In DriveInfo.GetDrives()
If drive_info.DriveType().ToString = "Network" Then
With maps.Items.Add(drive_info.Name)

[code]......

View 2 Replies

How To Map Network Drive That Requires Username And Password

Jul 7, 2010

I need to map a network drive from within a .NET application. I'm going to need to use an AD Username and Password to authenticate. Usually I just use a batch file with the net use command. How do I do this from within C# or VB.NET code?

View 4 Replies

Mapping A Network Drive Using Username And Password

Jan 18, 2009

I'd like to write a VB script that maps a network drive, but I don't really know where to start. I'd like to script to ask for a username and password, then map the drive.should I write it VB or as a CMD batch file? NET USE Z: \serverfolder\%user% /USER:%USER%@domain /password:%pass%am not even sure I've got that syntax write.

View 5 Replies

Visual Basic 10 - Mapping Network Drive

Oct 14, 2010

Currently I am trying to create a small application which will be used to map a common network drive on an offline computer. Currently my form has: Location Username Password Domain I have these all setup so that when I click to map the drive it will automatically grab the entered information and map it to the W drive. I tried the code below but it isn't working, stating a W32 exception.

[Code]...

View 3 Replies

VS 2008 : Connecting To SQL Server From Network Drive?

Aug 3, 2011

I'm having a issue connecting to a SQL server from a network drive. [URL]But i'm not sure how to give my assembly a strong name?

View 6 Replies

VS 2008 Get Path Of Mapped Network Drive?

Dec 23, 2009

I was expecting this to be easy but it seems that it is not... all I want to do is loop through all drives on a computer and if the drive is a network drive then get the UNC path that this network drive maps to. Simples. I was expecting to just do this:

vb.net
For Each drv In IO.DriveInfo.GetDrives()
If drv.DriveType = IO.DriveType.Network Then
MessageBox.Show(drv.RootDirectory.ToString)
End If
Next

[Code]...

View 10 Replies

Write To A Mapped Network Share Drive?

Sep 21, 2011

I spent quite awhile trying to figure this out and not one single combination of path strings let this happen.

I usually error'd with the path is not found, part of the path could not be found, or wrong user name and password.

All I am using is the <asp:fileupload>.

View 2 Replies

Application Event To Check Network Drive Availability

Nov 29, 2011

I want to execute some code when a network drive is available. Just like our application even have NetworkAvailabilityChanged. I want this to work just like our Application Events.

Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.Devices.NetworkAvailableEventArgs) Handles Me.NetworkAvailabilityChanged
End Sub
Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
[Code] .....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved