Does anyone know how to go about registering an HTA as a trusted application in Windows so that it can access databases via ADO without first prompting the user with security concerns
// This is a security setting in IE, security which can be changed in registry for HKCU/HCLM // This revents ADO connection to databas as well as preventing error in ADODB.Connection // IE Security->Custom Level->Internet|Local Intranet: Access Data Sources Across Domains // Read more: http://www.jsifaq.com/SF/Tips/Tip.aspx id=5130
oWsh = new ActiveXObject("WScript.Shell")
function ie_security(bDisable){ var sKeyCU = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet var sKeyLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
if(bDisable){ oWsh.RegWrite(sKeyCU + "\\Zones\\1\\1406",0,"REG_DWORD") // Intranet zone oWsh.RegWrite(sKeyCU + "\\Zones\\3\\1406",0,"REG_DWORD") // Internet zone } else { oWsh.RegWrite(sKeyCU + "\\Zones\\1\\1406",1,"REG_DWORD") // Intranet zone oWsh.RegWrite(sKeyCU + "\\Zones\\3\\1406",3,"REG_DWORD") // Internet zone } }
I guess no one knows.... ...way to go Microsoft...
Anyway, I found a workaround for the security issue anyway: Encapsulate the script(s) that your application uses to perform high security tasks and register it as a WSC.
The issue wasnt really changing permissions for internet security zones, as that could grant unwanted access to other applications. It also doesnt take care of the fact that my application had a lack of permissions as the user would manually need to add my application to the appropriate security zone.
How to register an HTA as a trusted application?
David Sutherland
// This revents ADO connection to databas as well as preventing error in ADODB.Connection
// IE Security->Custom Level->Internet|Local Intranet: Access Data Sources Across Domains
// Read more: http://www.jsifaq.com/SF/Tips/Tip.aspx id=5130
oWsh = new ActiveXObject("WScript.Shell")
function ie_security(bDisable){
var sKeyCU = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
var sKeyLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
if(bDisable){
oWsh.RegWrite(sKeyCU + "\\Zones\\1\\1406",0,"REG_DWORD") // Intranet zone
oWsh.RegWrite(sKeyCU + "\\Zones\\3\\1406",0,"REG_DWORD") // Internet zone
}
else {
oWsh.RegWrite(sKeyCU + "\\Zones\\1\\1406",1,"REG_DWORD") // Intranet zone
oWsh.RegWrite(sKeyCU + "\\Zones\\3\\1406",3,"REG_DWORD") // Internet zone
}
}
dmadrian
...way to go Microsoft...
Anyway, I found a workaround for the security issue anyway:
Encapsulate the script(s) that your application uses to perform high security tasks and register it as a WSC.
Jassim Rahma
The WSC alternative worked fine.