473,385 Members | 1,829 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,385 software developers and data experts.

How to get filenames from shared network directory?

Hi All,
The following code works fine in VB.NET (Windows app and Web app projects) when converted to VB.
It also works fine in C#, BUT only in Windows app project. All tested applications contain only this code on loading of the application (form).

Why does it not work in C# Web app project? Could this be a bug? I am using VS.NET 2003 EA

System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("\\\\MyServer\\MyFolder\\M ySubFolder1\\MySubFolder2\\MySubFolder3\\MySubFold er4\\");
System.IO.FileInfo[] fi = new System.IO.FileInfo[500];
fi = di.GetFiles();
foreach (System.IO.FileInfo f in fi)
{
Response.Write(f.FullName + "<br>");
// Console.WriteLine(f.FullName);
}

Goran Djuranovic
Feb 3 '06 #1
4 9548
Do you get an exception? if so can you post it.
"Goran Djuranovic" <djurag@mmcREMOVE_TO_MAIL.org> wrote in message news:O8**************@TK2MSFTNGP11.phx.gbl...
Hi All,
The following code works fine in VB.NET (Windows app and Web app projects) when converted to VB.
It also works fine in C#, BUT only in Windows app project. All tested applications contain only this code on loading of the application (form).

Why does it not work in C# Web app project? Could this be a bug? I am using VS.NET 2003 EA

System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("\\\\MyServer\\MyFolder\\M ySubFolder1\\MySubFolder2\\MySubFolder3\\MySubFold er4\\");
System.IO.FileInfo[] fi = new System.IO.FileInfo[500];
fi = di.GetFiles();
foreach (System.IO.FileInfo f in fi)
{
Response.Write(f.FullName + "<br>");
// Console.WriteLine(f.FullName);
}

Goran Djuranovic
Feb 3 '06 #2
What is Response?

It works fine for me if I comment out response.write.

Feb 3 '06 #3
The exception is: "The network name could not be found".

Thanks for your response.

Goran Djuranovic
"Simon Hart" <srhartone@[no spam]yahoo.com> wrote in message news:%2****************@TK2MSFTNGP15.phx.gbl...
Do you get an exception? if so can you post it.
"Goran Djuranovic" <djurag@mmcREMOVE_TO_MAIL.org> wrote in message news:O8**************@TK2MSFTNGP11.phx.gbl...
Hi All,
The following code works fine in VB.NET (Windows app and Web app projects) when converted to VB.
It also works fine in C#, BUT only in Windows app project. All tested applications contain only this code on loading of the application (form).

Why does it not work in C# Web app project? Could this be a bug? I am using VS.NET 2003 EA

System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("\\\\MyServer\\MyFolder\\M ySubFolder1\\MySubFolder2\\MySubFolder3\\MySubFold er4\\");
System.IO.FileInfo[] fi = new System.IO.FileInfo[500];
fi = di.GetFiles();
foreach (System.IO.FileInfo f in fi)
{
Response.Write(f.FullName + "<br>");
// Console.WriteLine(f.FullName);
}

Goran Djuranovic
Feb 3 '06 #4
Did you use ASP.NET written in C#?
It works fine for me using Windows Application written in C#, but not the
Web app.

As for the response, I get the exception "The network name could not be
found".

Thanks for your response.

Goran Djuranovic
"KBuser" <Ky********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
What is Response?

It works fine for me if I comment out response.write.

Feb 3 '06 #5

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

Similar topics

1
by: Fred Mellender | last post by:
I wish to run a C# Windows Forms program on a Windows 98SE machine, from a directory that is owned by a Windows XP machine. The directory is shared via directory sharing from the XP machine to...
5
by: Rahul Anand | last post by:
Hi, I am facing a problem in accessing a network shared folder. I just wrote a test console application to test the behavior and found that in some cases the .NET does not releases the network...
8
by: John K. | last post by:
Hi I was wondering if it's possible to use the WebRequest class to access a file on windows shared folder with authentication? If yes, what would the syntax be? I've tried to look this up in the...
2
by: rbutch | last post by:
guys, i need a little help with this. this is working (well sort of) i get the info, but it's not moving to a new line as it iterates thru the array and all of the fields are like ONE HUGE LONG...
27
by: Javier Martinez | last post by:
Hi I have asp application in a machine with a virtual directory referring a shared directory in another machine When I try to load any aspx page of my portal I get the following error: ...
2
by: Paul Bromley | last post by:
How can I create a directory within a shared ntwork directory?? sServerName - is the Server name "\Docs" - is the shared directory "\Others" - is the directory to create. The following...
0
by: Dennis | last post by:
I have a shared folder on my network of 2 computers, "\\computer2\sharedocs" that has sharing set to read and write both. When I use new DirectoryInfo("\\computer2\sharedocs"), I get the value of...
4
by: Goran Djuranovic | last post by:
Hi All, The following code works fine in VB.NET (Windows app and Web app projects) when converted to VB. It also works fine in C#, BUT only in Windows app project. All tested applications contain...
10
by: Lloyd Dupont | last post by:
I have written a .NET application which does heavy use of interop (through ManagedC++). It works allright. Now someone askedme if it works when installed in a shared directory. So I'm testing,...
0
by: ColdCoffee | last post by:
Scenario: My computer: name : PrasComp pass : Pras123 Domain : XYZ Computer I wanna access: Name : AnoComp pass : #Pras
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.