Classic ASP migration to Windows 2016 Chilkat Zip Activex issue with temdir - asp-classic

This is as much a note for myself as to help anyone else.
We migrated a Classic ASP application to Window 2016. Everything worked in the end. Then an issue surfaced with some zip & download functionality for which we use a Zip component from Chilkat.
Initially, all looked well - the software component was installed and responded to instantiation, but the zip files did not appear on disk where expected.
What could it be? Modifying the code as:
Set oZip = Server.CreateObject(CHILLKAT_ZIP_OBJECT_NAME)
oZip.UnlockComponent(<the license code>)
oZip.WriteZipAndClose()
Response.Write "<pre>" & Server.HTMLEncode( ozip.LastErrorText) & "</pre>"'
response.end
Produced
ChilkatLog:
WriteZipAndClose:
DllDate: Mar 1 2011
UnlockPrefix: *******
Username: *******
Architecture: Little Endian; 32-bit
Language: ActiveX
tempFile: .\ckz_40NT.tmp
Encryption: 0
PasswordProtected: 0
Failed to open file (2)
filename: .\ckz_40NT.tmp
currentWorkingDirectory: C:\Windows\SysWoW64\inetsrv
osErrorInfo: Access is denied.
Filename: .\ckz_40NT.tmp
Failed to open output Zip file
zipFilename: .\ckz_40NT.tmp
Retrying with a new temp filename
Encryption: 0
PasswordProtected: 0
Failed to open file (2)
filename: .\ckz2_I473.tmp
currentWorkingDirectory: C:\Windows\SysWoW64\inetsrv
osErrorInfo: Access is denied.
Filename: .\ckz2_I473.tmp
Failed to open output Zip file
zipFilename: .\ckz2_I473.tmp
tempFileName: .\ckz2_I473.tmp
Cannot open temporary file
Failed.
What could the prolem be ?

The issue was with chilkat's tempdir setting. On our version of Chilkat Tempdir defaulted to the IIS home folder which is unlikely ever to be happy having random files written to it. Adding a line to set tempdir to something more sensible, as below, cured the issue.
Set oZip = Server.CreateObject(CHILLKAT_ZIP_OBJECT_NAME)
oZip.UnlockComponent(<the license code>)
' added the next line !
oZip.TempDir = Server.MapPath("/some accessible folder path")
oZip.WriteZipAndClose()
Response.Write "<pre>" & Server.HTMLEncode( ozip.LastErrorText) & "</pre>"'

Useful info. I'm a Classic ASP programmer and at some point will need to move from Windows 2012 to Windows 2016. Been putting it off!

Related

Error when launching Kibana : cannot execute binary file - undefined error 0

I'm very new to the ELK stack and was trying to add some security settings (username and password) to access Kibana following the instructions from the link below:
https://www.elastic.co/blog/getting-started-with-elasticsearch-security
At Step 4: Security in Kibana, once the yml file modified, I try to launch Kibana from the terminal with the command ./bin/kibana but it displays the following errors :
./bin/kibana: line 24: /usr/local/var/homebrew/linked/kibana-7.6.2-linux-x86_64/bin/../node/bin/node: cannot execute binary file
./bin/kibana: line 24: /usr/local/var/homebrew/linked/kibana-7.6.2-linux-x86_64/bin/../node/bin/node: Undefined error: 0
I think I've followed all the previous steps carefully and everything else worked so far.
I'm using a Mac and the error seems to be very basic. Any clue?
Thanks for the help.
Looks like you've downloaded the wrong architecture (Linux) of Kibana on your Mac.
This generally happens when the architecture is not compatible with system architecture or running a 64 bits on 32 bits machine.
Simple solution:
Download the mac version of Kibana from here - https://www.elastic.co/downloads/kibana
Once downloaded, run ./bin/kibana in Kibana directory.
This will successfully start local server of Kibana on localhost:5601

Include_file_not_found error running classic ASP on IIS 8.5

I have a frustratingly simple problem. I've migrated a classic ASP site from a Windows Server 2003 IIS site to a shiny new 2012 R2 Server running IIS 8.5.
When I navigate to the home page (http://mydns/default.asp), I get a 500 error. The IIS logs show me this error:
GET /default.asp |4|ASP_0126|Include_file_not_found
Looking at the default.asp page, I see the following code at the top of the file:
<%# Language=VBScript %>
<!-- #include file="Include/common.asp" -->
<%
dim EMAIL_ID
if Request.QueryString = "" then
...
So, my assumption is that the error is being thrown due to the second line. In the website directory, the Include directory does exist, and there is a common.asp file inside of it.
# the default.asp page that I'm loading...
E:\websites\mywebsite>dir | findstr default
09/29/2015 10:30 AM 3,237 default.asp
# the common.asp page within the Include folder...
E:\websites\mywebsite>dir Include | findstr common
06/30/2015 10:27 AM 546 common.asp
Any idea why I would be getting an error about a file not found when I do see it in that directory?
Update 1: By navigating to the common.asp page in a browser, I get the following error in IIS:
GET /Include/common.asp |42|800a01ad|ActiveX_component_can't_create_object:_'Domain.clsAuth'
I found this article which helped me confirm that a DLL is missing so I am pursuing installing it on the new server.
Update 2: I was able to find the required Domain.dll on the old server. I used Dependency Walker to determine that Domain.dll depended on MSVBVM60.DLL so I grabbed both of these and moved them to the new server. I registered MSVBVM60.DLL successfully using C:\WINDOWS\system32>regsvr32.exe MSVBVM60.DLL, but registering Domain.dll failed. I got the following error message:
It turns out that this is the same error that you get if you try to register a file that doesn't exist. For instance, I tried to register "dummy.dll" and got the same error. It's like the system doesn't see the file. It autocompletes at the command line, but I can't register it. I also can't open it in Dependency Walker... the application says file not found. But I know it's there...
C:\WINDOWS\system32>dir | findstr Domain
04/27/2006 02:57 PM 24,576 Domain.dll
Update 3: The issue about registering the DLL was a 32 vs 64 bit thing. I had a 32 bit DLL in the system32 folder which is a 64 bit only folder. Once I moved it to the SysWOW64 folder (which is a 32 bit folder, go figure) I was able to register it. I also unregistered MSVBVM60.DLL from system32 and found that it was already available in SysWOW64.
So, this DLL issue is solved! But I'm getting the same error again due to a different include file. To be continued...
Update 4: The final include file error was indeed a missing include file.
Answering my own question... In my case, the issue was that the include file in question was throwing errors. I guess the fact that the ASP engine couldn't render the ASP include file resulted in the parent page throwing a "not found" error. By installing and registering a missing DLL, I was able to resolve my issue. Checkout the updates in the question for details.

WinSCP error while uploading file occurring randomly

We are using WinSCP to transfer files to a SFTP server by invoking commands in .net code. On the other end, an automated process grabs the file and moves it to another location. The below is the .Net code being used.
With winscp.StandardInput
.WriteLine("option batch abort")
.WriteLine("option confirm off")
.WriteLine("open sftp://" & username & ":" & password & "#" & remotehost)
.WriteLine("option transfer binary")
.WriteLine("lcd " & localFilePath)
If Not remoteFilePath Is Nothing Then .WriteLine("cd " & remoteFilePath)
If remoteFileName Is Nothing Then .WriteLine("put " & localFileName) Else .WriteLine("put " & localFileName & " """ & remoteFileName & """")
.Close()
End With
In some cases, when the WinSCP issues the PUT command,
Creates the partial file
Renames it back to original name
The process at the other end moves the file
Then our process creates the partial file again and tries to delete the file with original name.
Not sure why the step#4 is happening, as we don't have any logic in our code to place the partial file again and delete the original file.
Please see the following log from the SFTP server.
2015-03-05 22:30:59 - Account\UserID [3346178]created
/in/YYYXXX.xml.filepart - 226 - 1178853 - 22
2015-03-05 22:31:21 -
Account\UserID [3346178]rnfr /in/YYYXXX.xml.filepart - 350 - - 22
2015-03-05 22:31:21 - Account\UserID [3346178]rnto /in/YYYXXX.xml -
250 - - - 22
2015-03-05 22:31:25 - Account\UserID [3346215]sent
/in/YYYXXX.xml - 226 - 17924096 - 22
2015-03-05 22:31:26 -
Account\UserID [3346220]dele /in/YYYXXX.xml - 250 - - - 22
2015-03-05
22:31:28 - Account\UserID [3346209]created /in/YYYXXX.xml.filepart -
226 - 1178853 - 22
2015-03-05 22:31:28 - Account\UserID [3346209]dele
/in/YYYXXX.xml - 550 - - - 22
From the log the original file(YYYXXX.xml) is already deleted by the other process (refer #5) and gives the below error.
Unable to SFTP XML file. Error Message: from PutSFTP: There was an
error transferring YYYXXX.xml. Error deleting file 'YYYXXX.xml'. After
resumable file upload the existing destination file must be deleted.
If you do not have permissions to delete file destination file, you
need to disable resumable file transfers. No such file or directory.
Error code: 2 Error message from server (en): File not found Request
code: 13
Also there is no pattern in the occurrence of this issue i.e not based on file size, date, etc.
We have already included the option confirm off in the script, so resuming should take place as needed. We are using WinSCP Version 5.0.5 (Build 1782).
Is there anything else we need to change/configure ? Let me know what additional info you need from me.
Have you tried using the .NET assembly that you can get as a separate download? I've been using it for a while and it hasn't given me any problems. WinSCP .NET Library
You may also want to look at this bug report : Here
ResumeSupport requires that the .filepart file be written to the ftp site and deleted or renamed. If you don't have permission, you get an error.
The fix is to turn off resume support by updating the WinSCP.ini file and set ResumeSupport=2
More documentation on Resume support here

Mono Site Failed to map path '/App_WebReferences/.... Error

I have an open source asp.net site that is meant to run under apache/mono. I have a new version I am all ready to release but it has a problem running under linux. Everything works great on windows.
The first time I load the page I get:
System.InvalidOperationException Failed to map path '/App_WebReferences/MythContent/ContentServices.wsdl'
The file is there:
-rw-r--r-- 1 www-data www-data 37K Nov 20 2013 mobilemyth/App_WebReferences/MythContent/ContentServices.wsdl
Refresh the page again and you get:
System.IO.IOException
Sharing violation on path /tmp/www-data-temp-aspnet-0/9e3969b/Resources.frontendsettings.aspx.resources
And that is all you get from them on. Any ideas?
In Mono, the best solution for this issue is using the wsdl2 command line and generate the class an put it in the App_Cod. So you can use the WebService client in your app.
Sample:
$ wsdl2 http://< your url of wsdl >?WSDL

Drush make - errors unzipping and distinguishing mime times

I've installed Drush 5.8 on Windows 2008 R2 Enterprise, with all the options included except Remote Management.
Whenever I run drush make I get errors about it not being able to unzip a github archive file, and unable to determine mime type for a js file. Here is my make file and the output. I'm not sure what is wrong here, and would love any pointers you may have.
Make file:
; Drupal 7 core
core = 7.x
api = 2
projects[drupal][version] = 7
; Libraries
; --------
libraries[colorbox][download][type] = "get"
libraries[colorbox][download][url] = "https://github.com/jackmoore/colorbox/archive/1.4.8.zip"
libraries[colorbox][directory_name] = colorbox
libraries[colorbox][destination] = libraries
libraries[zepto][download][type] = "get"
libraries[zepto][download][url] = "http://zeptojs.com/zepto.min.js"
libraries[zepto][directory_name] = zepto
libraries[zepto][destination] = libraries
Output:
C:\Users\Administrator\Desktop\drush>drush make test.make testing
Could not locate drupal version 7, will try to download latest recommended or supported release. [warning]
drupal-7.21 downloaded. [ok]
colorbox downloaded from https://github.com/jackmoore/colorbox/archive/1.4.8.zip. [ok]
Unable to unzip C:\Users\ADMINI~1\AppData\Local\Temp\1/make_tmp_1364915473_515af511066a2/1.4.8.zip. [error]
zepto downloaded from http://zeptojs.com/zepto.min.js. [ok]
Unable to determine mime type for zepto.min.js. [error]
Finally got it figured out after a lot of struggle.
Using Cygwin I was able to get a copy of unzip, which I put in the Program Files (x86)\Drush\GnuWin32\bin directory (which is in my PATH environment variable). This cleared up the errors listed about unzip.
As for the mime-type issue, I had to manually edit includes/drush.inc to add '.js' => 'application/javascript' to the $extension_mimetype array. See http://drupal.org/node/1825946 for the discussion that led me to this.

Resources