HTA : "Safety Settings on this computer prohibit accessing a data source on another domain" - hta

I am dealing with the same error message (as the subject) like two other threads:
Suppress ADO Security Warning in JavaScript/HTM Page and
How to create intranet website accessing database dynamically without server or server side scripts?
but my application runs on the local computer only, it has nothing to do with any network or remote database.
The problem happens on some of my users' computer only. I have simplified the program to 1.js and 1.hta as listed below. Run 1.js through command line "cscript.exe 1.js" works fine on the users' computer (Windows 7). But run 1.hta on the same computer got the error "Safety Settings on this computer prohibit accessing a data source on another domain". 1.js and 1.hta are nearly the same!
The line that makes the problem is calling : ado.LoadFromFile("1.hta");
I have to use ADO instead of fso (Scripting.FileSystemObject), because fso can't access utf-8.
==== 1.js ===========
// run me through a DOS box command line : cscript.exe 1.js
var ado;
ado = new ActiveXObject("ADODB.Stream");
var data;
ado.CharSet = "utf-8";
ado.Open();
ado.LoadFromFile("1.js");
data = ado.ReadText();
ado.Close();
WScript.echo(data);
==== 1.hta ==========
<HTML>
<HEAD>
<meta http-equiv="x-ua-compatible" content="ie=9">
<HTA:APPLICATION ID="Debug"
caption="yes"
maximizebutton="no"
minimizebutton="no"
sysmenu="yes"
BORDERSTYLE="complex"
BORDER="thick"
/>
<TITLE>HTA - Debug</TITLE>
<script language="JScript">
var ado;
ado = new ActiveXObject("ADODB.Stream");
var data;
ado.CharSet = "utf-8";
ado.Open();
ado.LoadFromFile("1.hta");
data = ado.ReadText();
ado.Close();
</script>
</HEAD>
<BODY>
<H2>HTA - Debug, try to read my own source code "1.hta"</H2>
<div id=sourcecode></div>
<script language="JScript"> sourcecode.innerText=data;</script>
</BODY>
</HTML>
1.hta works fine on all Windows7, windows 8, windows 10 computers I can find. To make sure someone who can help me would be able to 100% reproduce the problem, I have found that 1.hta always failed on Windows XP. That's the only way I can reproduce the problem. We have tried to change IE's security settings, it doesn't work for either fixed the computer in ill or push any healthy computer into illness. I believe HTA does not refer to IE's settings.
Why is this happening on some computers? Point me any hint would be very much appreciated.

This worked well for me! tnx!
Modify the internet options in IE:
Go to Internet options -- Security Tab -- Select Internet and Local Intranet -- click Custom Level (button ) -- Miscellaneous -- select enable for Access data source across domains.
After that I reopened theQLIKVIEW model.
For me it worked..
Good Luck

Related

Trouble closing pdf window displayed in .net modal dialog Adobe Reader “protected mode” enabled

Hi ~ We have just updated Adobe Reader to DC. I've spent days searching for a solution to my problem but have come up empty. The situation is this..I am rendering a byte string in a .net aspx page that is launched as a modal dialog with code like this:
Contents = some byte string
Response.Clear()
Response.ContentType = "application/pdf"
Response.BinaryWrite(Contents)
Response.End()
Easy right? The pdf shows up and everything works just fine. The problem is when I close the dialog box taking 20 seconds or more to close (window.close();). I have the most recent Adobe updates and yes, unchecking 'Enable Protected Mode at startup' solves the problem but our customers are not comfortable with this solution so I've been tasked to figure out an alternate solution without rewriting our entire application. Can anyone provide insight as to what the checkbox is actually doing that might cause a delay on a window.close? One caveat, my local machine does not have this problem even with the checkbox checked. My machine: IE11/Windows 7 Enterprise 64-bit. Server with the problem: IE10/Windows Server 2012 Standard 64-bit. Customers: setups unknown. So I've been focusing more on the differences between my local machine and our server 2012 machine going through the registry, IE settings and Adobe settings. Nothing stands out so here I am praying for the knowledge of someone else. Thanks for any help you can provide.

ASP Classic WshShell.RegRead error '80070002'

I'm reading some registries in ASP Classic to get some values I need and saving them as application level variables. In the global.asa file I have the code:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("test") = "testing..."
Dim WSHShell, regLink
Set WSHShell = CreateObject("WScript.Shell")
regLink = "HKEY_LOCAL_MACHINE\SOFTWARE\Odyssey\"
Application("test2") = WSHShell.RegRead(regLink & "value")
End Sub
</SCRIPT>
In my test.asp file, I simply output the "test" and "test2" variables. However, on running test.asp, I get the error message:
WshShell.RegRead error '80070002'
Invalid root in registry key
I have checked and double checked that the key indeed exists, and this code worked on our old server, so I think it is a configuration issue in IIS. I'll be damned if I can find it though. ASP Classic is installed and enabled, and I'm using IIS 7.5 on Windows Server 2008 R2 x64. Hopefully someone has an idea of what the problem is.
EDIT: I downloaded Process Monitor to look at the registry access. After some searching. I found that it is actually looking for the key in "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Odyssey\value". I gather this has to do with the server being 64x. I don't want to move the keys to that location, as they will likely never be found again, especially when the code points to a different directory.
Is there a way to stop this redirection or change the structure so this can work?
Thanks in advance for your help.
Doug
As mentioned in the edit to my question, the problem appears to be that the URL was being redirected because it was a x64 system. I ended up moving the registries I was trying to access to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Odyssey. I then modified the code slightly to look for the keys in that location specifically.
regLink = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Odyssey\"
Since I specified the Wow6432Node myself, the system won't add another one in. I would've rather kept the keys in their previous location, but at least the code points to where they are. As it was previously, someone looking at the code would never have guessed to look in the Wow6432Node directory. The important part is that the keys will not be lost to the depths of the Windows registry system.

QWebKit does not show some images on specific platforms

I'm programming a very simple Qt-based application which will be interfacing some website. That website requires user to login with username/password and solved Captcha. Because of that Captcha, I decided to use QWebKit and just display the website for the user (and intercept cookies in my app). It works almost great. Almost, because I'm having a really strange problem.
On Linux my app worked like a charm. On 64bit Windows 7 (32 bit build with VS 2010) - it worked without problems too. But the same binary has a very strange issue under 32bit Windows 7. It works, but does not display Captcha images making logging in impossible. Of course, I used Dependency Walker and ensured that all the DLL's are accessible.
The Captcha is not a popular reCaptcha or something, but Minteye slider Captcha (BTW, in my humble opinion it is quite easy to solve by a computer). As you can see at the bottom of the page I linked to, this captcha downloads a series of images and user has to select the "correct" (ungarbled) one with a slider.
The problem is, that for no apparent reason, my app just doesn't show these images on 32bit Windows 7, while on 64bit version everything works. The code I'm using is very simple, but I'm posting it anyway:
loginView = new QWebView();
QWebPage *page = new QWebPage();
manager = new QNetworkAccessManager();
loginView->setPage(page);
page->setNetworkAccessManager(manager);
jar = new QNetworkCookieJar();
manager->setCookieJar(jar);
page->mainFrame()->load(QUrl("http://site.to.open"));
loginView->show();
I verified with Wireshark that these images are indeed being downloaded from the server. I even changed user agent string to hardcoded one to be sure that the server doesn't mess up something only for for 32bit windows 7. Unless I'm missing something, the dialogue with the server is identical and the problem is on client's side.
The only thing that differs (and I'm pretty sure is connected to my problem) is behaviour of WebKit when trying to navigate to specific URL via developer tools (one can enable them in QWebKit, so did I). When I open the Javascript console for login page and enter:
window.location = "http://www.google.com"
It works on all my platforms. But, when I enter the address of one of the Captcha images:
window.location = "http://img2.minteye.com/slider/image.ashx...
Results vary. On Linux and 64bit Windows 7 it works and I can see an image. On problematic 32bit Windows 7, WebKit shows error Frame load interrupted by policy change and that's all. I have no idea what that error means and what "policy" changed. Google search didn't help me - I found posts by people complaining that they see this error, but nobody explained what causes it (WebKit source isn't super helpful too). If somebody knows, I might be able to get a workaround for my problem.
I'm also very courious, why this problem is present only on 32bit version of Windows 7.
Seems like this is/was a bug in QtWebkit implementation, you can read more about it here:
https://bugs.webkit.org/show_bug.cgi?id=37597
Which version of Qt and QtWebkit are you using ?
It might be a good idea to try a newer version of Qt & QtWekbit.
If it helps in any case here is the code in Webkit which shows this error:
http://src.chromium.org/svn/branches/WebKit/472/WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp
This is not a bug.
What happens is that this image was generated dynamically, probably Headers were misconfigured.
the Frame load interrupted by policy change occurs because the WebView tries to open something that is not "text/image" (is not supported).
You should use this ( https://stackoverflow.com/a/16782607/1518921 ):
//replace [QWebView] by your WebView
connect([QWebView]->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(downloadContent(QNetworkReply*)));
...
void [main class]::downloadContent(QNetworkReply *reply){
//Replace "[main class]" by "Class" having the signs used in WebView.
[QWebView]->stop();
//solution: stop loading --replace [QWebView] by your WebView,
/*function to donwload*/
}
At this point if you have a download manager, it will ask to save the image instead of opening it, because the content is not supported.
Solutions:
What you can do is try to fix image headers.
if your server is not then there will be, then you will have to parse the header Content-type and see what type it is trying to send, having kind of content you will have to reimplement the QWebPage:
virtual bool extension(Extension extension, const ExtensionOption *option = 0,
ExtensionReturn *output = 0);
virtual bool supportsExtension(Extension extension) const;
Good luck.

Convert HTML to RTF (Rich Text) using a web-browser control in ASP.NET

var webBrowser = new WebBrowser();
webBrowser.CreateControl(); // only if needed
webBrowser.DocumentText = *yourhtmlstring*;
while (_webBrowser.DocumentText != *yourhtmlstring*)
Application.DoEvents();
webBrowser.Document.ExecCommand("SelectAll", false, null);
webBrowser.Document.ExecCommand("Copy", false, null);
*yourRichTextControl*.Paste();
The above code works fine on a local computer, but when I deploy it on a remote computer or on shared hosting webserver, the copy command doesn't work at all. I checked and found that Clipboard is always empty, so RFT text is always empty. It seems the web-browser control SelectAll and Copy commands don't work on deployment servers. I am looking for a solution to this problem.
I remember having similar problems with the web browser control. I think it was related to the settings of Internet Explorer. Try reducing the security settings in Internet Explorer.

Classic ASP on IIS7: ADODB.Stream error File could not be opened - accessing outside the webroot

I've just reinstalled a server, it is a new machine, same OS verion (Win2008) and same IIS version (7.0). The app was working perfectly (and then the machine blew up).
I'm getting this error when I try to access a file outside the webroot:
ADODB.Stream error '800a0bba' File could not be opened
I can access it fine using FileSystemObject, but cannot open it with ADODB.Stream.
Also, I can create a PDF using abcPDF, but I cannot create one again with the same name and overwrite it (this used to work). This works fine inside the website folder structure but not outside.
Also, I cannot attach a file using JMail any more. This applies to files BOTH inside and outside the webroot. So that is weird.
I've assigned Full Control to Everyone on the whole drive to isolate whether it is a permissions problem and it made no difference.
Any ideas anyone?
UPDATE: The problem with attaching files inside the site does not appear to be happening any more, since I mucked round with several things. I'm not sure what did it unfortunately. I got nowhere on this and lost hours over it, so I ended up move all the files inside the webroot and now everything works. This is not ideal and I would still like to get to the bottom of it, but the workaround is acceptable.
Updated question as I accidentally wrote Win2003 instead of 2008.
I think you should check the from your database in the first place how you save the PDF file in question. That is where you saved the file in question into the database from the same machine or from a remote machine. Usually when you save from the same developer machine and you are accessing there will be no error but when the file was saved from a machine other than the developer machine, then you will have such error.
For example:
'1. dbSignatureImage = New ADODB.Stream
'2. dbSignatureImage.Type = ADODB.StreamTypeEnum.adTypeBinary
'3. dbSignatureImage.Open()
'4. dbSignatureImage.
LoadFromFile(dbRecordSet.Fields("client_signature_filename").Value)
From the above code, I was trying to display two different images from the database (one at a time) and among the two images I saved one directly from the developer machine and the other image was saved from a different PC over my network. Whenever I try displaying the second image which was saved from a network PC, then I have the error of file could not be opened. Now what I did was commenting the 4th line and the error seized but then the image was not displaying so I tried displaying the image itself directly from the BLOB field using IO.MemoryStream with the following codes and it is working fine for both the developer machine and any PC over the network.
Dim PassportImageArray() As Byte = CType(dbRecordSet.Fields("client_passport_image").Value, Byte())
Dim SignatureImageArray() As Byte = CType(dbRecordSet.Fields("client_signature_image").Value, Byte())
Dim PassportImageMemoryStream As New MemoryStream(PassportImageArray)
Dim SignatureImageMemoryStream As New MemoryStream(SignatureImageArray)
With picSearchPhotograph
.Image = Image.FromStream(PassportImageMemoryStream)
.SizeMode = PictureBoxSizeMode.StretchImage
.BorderStyle = BorderStyle.None
End With
I think you can go round your problem with this my small idea. I hope it will you some how.
Kasapa-Sunyani
You probably need to take a closer look at the security permissions on the folders outside of your applications home folder. Also take a look at the what user identity is actually used to run your code, for example do you have windows integrated security turned on? If not, is that true of the previous server?
It might help if we could know for sure whether this really is an IIS7 question in which case your server is 2008 not 2003. You might also find that this sort of thing is best handled by the serverfault.com people.
The problem with attaching files inside the site does not appear to be happening any more, since I mucked round with several things. I'm not sure what did it unfortunately. I got nowhere on this and lost hours over it, so I ended up move all the files inside the webroot and now everything works. This is not ideal and I would still like to get to the bottom of it, but the workaround is acceptable.

Resources