Blog of a Filipino Developer about C#, VB.NET, ASP.NET, Java, PHP, SQL Server, MySql and Oracle RSS 2.0
 Saturday, November 17, 2007

More than 2 years ago I wrote this article and submitted it in CodeProject detailing how you can build a FileSystem Browser in ASP.NET. The article talks about how newbie ASP developers moving to ASP.NET might code the solution and how somebody a little bit more familiar with ASP.NET would build the same application in lesser code.

Somebody emailed me about my article yesterday asking for some guidance. This lead me to inspect my old article. The first thing i said to myself after seeing my old code is 'Yikes! I did that?'. Yup, it was that horrible. The solution works, its functional based on the need but I knew i could clean it up and code it much better if i had the chance to do it a second time around. That chance happened today.

I haved changed the way i read folders(before it was using query strings). I have replaced that logic by placing the path inside my LinkButton CommandArgument property. How i pass the FileSystemInfo[] to the grid(it was using an intermediate datatable) and the type of control that displays the data(it was using a datagrid before now we are using a gridview). I've also added a breadcrumb like control to track the users location and made it a little bit prettier by adding icons instead of plain text descriptions.

I'll be updating this constantly based on the request I haved received from my original article. The most common request is sorting which I will add on the next release.

Hopefully this version is less crappier than the last.

*Update*

Thanks to Andreas Haydeck for pointing out a bug in the BuildNavigatorPath method that causes the navigator path not to show the proper folder location. This has been fixed and the code in this article has been updated.

Download the latest source here: KeithRull.FileSystemManagerRevisited.zip (6.57 KB)

Saturday, November 17, 2007 12:02:24 AM (GMT Standard Time, UTC+00:00)  #    Comments [5] -
.NET | Fun Stuff
Tuesday, November 20, 2007 2:04:10 PM (GMT Standard Time, UTC+00:00)
Hello Keith! I liked ur FileSystem browser very much and want to use it on my website. But i can't make ur application work - i always get "You dont have access to view this folder." I've changed path from "c:\Dell" to "\test", granted all access to this folder, but nothing i got - still no access. I'm not a programmer, just user, so please, explain me what to do?
Thanks in advance.

P.S.: sorry for bad English, i'm from Russia.
Tuesday, November 20, 2007 2:34:00 PM (GMT Standard Time, UTC+00:00)
I've found out that ur program does not support relative paths, am I right? Could you fix it, please?
Tuesday, November 20, 2007 5:33:37 PM (GMT Standard Time, UTC+00:00)
Hi,

what you could do is change the the variable CONST_RootFolder from this:
private string const CONST_RootDirectory = @"C:\Dell\";

to this: private string CONST_RootDirectory = String.Empty;

then change the page_load event to this:
protected void Page_Load(object sender, EventArgs e)
{
//this is your initial path
CONST_RootDirectory = this.MapPath("");
if (!IsPostBack)
{
ShowFolderContents();
}
}

what the code above does is that it sets the CONST_RootDirectory variable to the applications path which in your case would be:

//this code defaults the folder brower to a folder called test
CONST_RootDirectory = this.MapPath("test");

HTH
Wednesday, November 28, 2007 12:56:14 PM (GMT Standard Time, UTC+00:00)
Hi,

It is very nice, is possible view with format/style Treeview

Thanks
Gianpaolo
Wednesday, November 28, 2007 8:28:33 PM (GMT Standard Time, UTC+00:00)
Yes it is possible to do it that way but you need to change the code. Just change the control to a treeview and bind the proper columns to the treeview node.
Comments are closed.
On this page
Archive
<December 2008>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Keith Rull
Sign In
Statistics
Total Posts: 260
This Year: 57
This Month: 0
This Week: 0
Comments: 116
Themes
Pick a theme:
Ads
All Content © 2008, Keith Rull
DasBlog theme 'Business' created by Christoph De Baene (delarou)