Well, your links are just for one method that will only work in IE. You cannot write this code in C#. ASP.NET code runs only on the server, not on the client browser. If that's what you did, it's no surprise that it doesn't work.
Google for "
javascript folder browser[
^]" for examples of doing it in client-side javascript code.