473,941 Members | 4,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using DirectoryInfo Class

I am trying to use the DirectoryInfo class to create links on a web page to
files in the specified directory. I can get it to work just fine. The
problem I am having is when I try to put in a UNC path, it does not work. It
says it cannot find the specified path. Below is the code I am using

Dim dirInfo as New DirectoryInfo(" \\ServerName\Di rectory\SubDire ctory")

I can only get this to work when I use local directories such as "D:\"

Any help is appreciated.
Thanks
Aug 31 '05 #1
1 1387
Hmm, is there any permissioning problems... I just used this
DirectoryInfo di = new DirectoryInfo(@ \\server2\softw are); and it worked
fine.

The documentation specifically states yoiu can use UNC
http://msdn.microsoft.com/library/de...classtopic.asp
so there may b e some other problem...like full read/write access

"Andy" <An**@discussio ns.microsoft.co m> wrote in message
news:37******** *************** ***********@mic rosoft.com...
I am trying to use the DirectoryInfo class to create links on a web page to
files in the specified directory. I can get it to work just fine. The
problem I am having is when I try to put in a UNC path, it does not work.
It
says it cannot find the specified path. Below is the code I am using

Dim dirInfo as New DirectoryInfo(" \\ServerName\Di rectory\SubDire ctory")

I can only get this to work when I use local directories such as "D:\"

Any help is appreciated.
Thanks

Aug 31 '05 #2

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

Similar topics

7
12165
by: Charts | last post by:
I login as administrator of the machine. However running the following code get access denied exception for file inside the directory. The source code: DirectoryInfo target = new DirectoryInfo(TargetDirectory); target.Delete(true); I don’t have problem manually delete the whole directory. Please advice. Thanks,
0
900
by: I am Sam | last post by:
I keep getting an error that my listbox control is incompatible with the source as follows: The base class includes the field 'IMGList', but its type (System.IO.DirectoryInfo) is not compatible with the type of control (System.Web.UI.WebControls.ListBox). the following is the codebehind: public class EventBroadcast : System.Web.UI.Page {
3
2408
by: xenophon | last post by:
This following innocuous code: System.IO.DirectoryInfo fff = new System.IO.DirectoryInfo(); System.IO.FileInfo ppp = fff.GetFiles( Request.MapPath(".") ); for( int ccc=0 ; ccc < ppp.Length ; ccc++ ) { System.Web.HttpResponse.Response.Write( "<a href=\"" + Request.MapPath(".") + "/" + HttpUtility.HtmlEncode(ppp.Name) + "\">link</a>" );
13
2659
by: Tom Scales | last post by:
OK, I admit, I am not a VB.NET expert and am still learning, but have run into an annoying problem. I'm writing a program that has to search the file system and therefore processes large numbers of directories and files. I've figured out DirectoryInfo (it's pretty simple), but when I invoke DirectoryInfo.GetFiles (or even DirectoryInfo.GetDirectories), it can take forever. Some of the directories have thousands of files in them. So, my...
1
283
by: Andy | last post by:
I am trying to use the DirectoryInfo class to create links on a web page to files in the specified directory. I can get it to work just fine. The problem I am having is when I try to put in a UNC path, it does not work. It says it cannot find the specified path. Below is the code I am using Dim dirInfo as New DirectoryInfo("\\ServerName\Directory\SubDirectory") I can only get this to work when I use local directories such as "D:\" ...
2
2194
by: rn5a | last post by:
Suppose I have the following code: <script runat="server"> Sub Page_Load(.....) Dim dInfo As DirectoryInfo Dim fsi As FileSystemInfo dInfo = New DirectoryInfo(Server.MapPath("Folder1")) For Each fsi In dInfo.FileSystemInfo
2
8634
by: rn5a | last post by:
Using the FileSystemInfo class, I am retrieving all the directories & files existing in a particular directory on the server & listing them in a ListBox. If an item in the ListBox happens to be a directory, then the ListItem should display the directory name which will be appended with the text <DIR>. If an item in the ListBox happens to be a file, then the ListItem should display the file name which will be appended with the size of the...
8
5268
by: JonnyBlaze | last post by:
Hi Guys - This is my first C# app, but I have some knowledge of a bunch of languages like VB6 and PHP, so I'm picking it up rather quickly. I've been pulling my hair out on this one for about 4 hours now. I have a DirectoryInfo on my parent form: (extra bits chopped out...) public partial class frmMain : Form { public DirectoryInfo diTemp;
0
2160
by: nagashree | last post by:
Hi, i want to compress the file or directory i am able to do that can anybody help me to decompress the file when i double click on the zipped file i am getting the error message as compressed(zipped) folder is invalid or corrupted. I am using VB.NET .Please help me out in this regard...Thank you in advance. Here is the code for that. Public Class clsZip
0
9964
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11113
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11296
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9858
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6298
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4450
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.