Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1470
  • Last Modified:

BrowseForFolder() raising Permission denied error in XP Internet Explorer

function fnGetMyPathJ(formObj)
{
      var oShell = new ActiveXObject("Shell.Application");
      var oFolder = new Object;                        
      oFolder = oShell.BrowseForFolder(0, "Choose a folder", 0);
      if(oFolder!= null)
      {
            var oFolderItem = new Object;          
            oFolderItem = oFolder.Items().Item();
            pathValue =oFolderItem.Path;
            folder_remotePath  =pathValue;

                  var fso = new ActiveXObject("Scripting.FileSystemObject");

                  var WshNetwork = new ActiveXObject("WScript.Network");
                  var oDrives =new Object;
                  oDrives = WshNetwork.EnumNetworkDrives();
                  alert(3);

                  for(i=0;i<oDrives.length-1;i=i+2)
                  {
                        if (oDrives.Item(i) == fso.GetDriveName(fso.GetAbsolutePathName(pathValue)))
                        {
                              alert(oDrives.Item(i+1));
                              remotePath= oDrives.Item(i+1);
                              drivePath= oDrives.Item(i);
                              folderPath=oFolderItem.Path;
                              folder_remotePath=folderPath.replace(drivePath,remotePath);
                        }
                        
                  }
            
            document.getElementById(formObj).value=folder_remotePath;
      }
}
My OS is XP. The above code is working in visual interdev but not in IE . It is raising PERMISSION DENIED error. In 2000 it is working fine.
0
lword
Asked:
lword
1 Solution
 
ClickCentricCommented:
Permission is denied for 2 reasons, licensing and security.
0
 
lwordAuthor Commented:
Its because of security.

To over come this please do the following
Go to Internet options->security Tab->Custom level->Initialise and script activeX control not marked as safe: Enable


Lword
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now