开发者

Folder/File browser with MVC 2?

How can you create a route that accept an undefined number of strings? The folder browser should be able to browse the specified folder and all the sub folders. Using JQuery to get the folders back from the server. The problem is how to build the JQuery?

$.ajax({
           type: "POST",
           url: "http://localhost:30218/Data/Folder1/Folder2/etc",
           dataTyp开发者_如何学Goe: "json",
           success: function (data) { }
       });

I mean, how can you create a MVC 2 url that could be like 10 subfolders deep? I don't want to define a static number of maximum folders that it can contain. How can you create the url and what routing should you use? Querystrings for subfolders?


You can use the catchall on the last route segment, which is the asterisk character, like so:

"Files/{action}/{*path}"

That would cause everything at the end to be lumped together in the path parameter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜