471,325 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 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 9429
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Rahul Anand | last post: by
8 posts views Thread by John K. | last post: by
2 posts views Thread by rbutch | last post: by
4 posts views Thread by Goran Djuranovic | last post: by
10 posts views Thread by Lloyd Dupont | last post: by
reply views Thread by rosydwin | last post: by

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.