Question - how to set up an unknown number of webevents for the FEZ Spider (required for sd-card browsing)

I would like to have a web based fileserver.
I have a unknown number of files and folders stored at the SD-card.

When the initial “index.html” is requested, the Spider responds with a list of the files and folders in the root.
So far no problems.

The folders are sent as hyperlinks, so the webclient can click on them.
But to browse through the files and folders, for each of them, A WebEvent is required.
This is where I get stuck.
Because the content of the SD-card changes, it is not possible to program all those webEvents.

So I need a Array or List of webevents, but the number is unknown.
Or I need a way to bypass path-specific webEvent, so there is only 1 event. In that case I can determine the current path/url in the eventHandler and respond with the corresponding files and folder.

Please provide me with a example, or any other help. Of course an alternative solution is also very welcome!

Thanks in advance,

Wireless.

Welcome to the forum!

Have you tried to search on Google? You should be able to find a lot of examples, since this is not NetMF specific.

@ wireless,

It sounds like you need a “Folder.html” page as well as your Index.html page.

Here is a simple overview of how it would work:
When a client clicks on a folder link in your Index page, they would be redirected to the Folder page.
The Folder page would be similar to the Index page, but would include an “Up” link to return to the previous view (of the parent folder).
Each folder link would include querystring parameters that include:
[ul]FullPath of the folder the link represents
ParentFullPath of the folder’s parent folder[/ul]
On your “server” you would use the FullPath value to create the folder contents list, and the ParentFullPath to create the “Up” link.
Of course there are many details that need to be filled in, but this should get you started.

EDIT: Actually thinking about this a little more… you probably can do all this with just your Index page.

@ Architect.
Thanks for the quick respond. I have tried google, (of course) but the examples I found were for webservers which don’t require events. When they are addressed like: 192.168.2.200:FolderName/FileName.txt, the server throws the file, or the ‘file not found page’. But that is the part which is not working for my Spider. So that is why I ended up here.

@ jasdev.
The problem is already the redirecting to the Folder page.
When the clients click the folder, the url changes to:
http://192.168.2.200/folder1/
And the server will seek such webEvent, which does not exists. So the webserver throws the ‘index’ event.
As you already mentioned in your edit. I only need the index event!

Thank you very much

I think this is what he was getting at:

http://192.168.2.200/index.html → is the default root page. It would go out and listing of all the files and folders in the root directory, as they exist at time of request.

http://192.168.2.200/index.html?p=folder1 → this would move the current folder to folder1 and then listing of all the files & folders there, as they exist at time of request.

http://192.168.2.200/index.html?p=folder1\sub1 → this would move the current folder to sub1 in folder1. and then listing of all the files & folders there, as they exist at time of request.

So the index would list the folders like this:


<a href="http://192.168.2.200/index.html?p=folder1">Folder1</a><BR>
<a href="http://192.168.2.200/index.html?p=folder2">Folder2</a><BR>
<a href="http://192.168.2.200/index.html?p=folder3">Folder3</a><BR>

Wheny you click on folder1:


<a href="http://192.168.2.200/index.html?p=folder1\Sub1">Sub1</a><BR>
<a href="http://192.168.2.200/index.html?p=folder2\Sub2">Sub2</a><BR>
<a href="http://192.168.2.200/index.html?p=folder3\Sub3">Sub3</a><BR>

no need to do multiple posts