Get UNC Path of a Specific File RRS feed

  • Question

  • User281214018 posted

    I am trying to get the unc path from a mapped network drive in ASP .NET (VB .NET).  I found the post about using the following javascript.


    <script type="text/javascript" language="JavaScript">
        function displayNetworkShares() {
            var WshNetwork = new ActiveXObject("WScript.Network");
            var Drives = WshNetwork.EnumNetworkDrives();
            var content = "<h1>Drive Mapping List</h1>";
            for (i = 0; i < Drives.length; i++) {
                content += "<p>" + Drives.Item(i) + "</p>";

    How do I call this javascript function from vb.net code behind passing in the drive letter and getting back the mapped network path into a textbox on the screen.

    Any help would be appreciated.

     Thank you.

    Thursday, November 6, 2008 9:58 AM

All replies

  • User-990694832 posted

    User server.mappath(yourfile)

    Also, the drive needs to be mapped as a virtural directory

     the js is not needed

    Hope this helps


    Thursday, November 6, 2008 10:52 AM
  • User281214018 posted

    I am trying to get the UNC Path of a client side mapped network drive.  I have a <input type="file" id = "MapFilePDF" runat = "Server">.  The user would use the browse button to find the PDF version of a map (ie T:\MyHome.PDF).  I want to get the UNC of T that is something like \\ServerName\Map.

     I don't think I can get that using the Server.MapPath.

    Thursday, November 6, 2008 11:16 AM
  • User-990694832 posted

    A person could use response.write("")

    or to answer the original ? -> Response.Write ("displayNetworkShares();")  in the codebehind.



    Thursday, November 6, 2008 4:55 PM