Archive for the ‘Microsoft’ Category.

Persits AspUpload, Content-type and Safari

A quick note for anyone using legacy server-side classic ASP and the Persits AspUpload component‘s sendBinary to download files to Apple’s Safari browser.

I ran into a problem recently where by Safari was appending “.html” to the file name of all downloads sent via the component. e.g. test.pdf would download as test.pdf.html. There are a couple of mentions on the apple support forums:

PDF files downloaded directly did not suffer this problem – suggesting that the server’s mime types seem ok. Other browsers did not suffer this problem. However the problem has to be server-side. i.e. the download via the script is being sent with Content-type text/html instead of application/pdf no matter what arguments I add to the sendBinary call.

The solution seems to be to manually set the script’s Response.contentType value. i.e. the following test script works…

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
    FILEPATH = "D:\WWWRoot\sitepath\www\pdftest\TEST.pdf"
    Dim upl
    Set upl = Server.CreateObject("Persits.Upload.1")

    Response.ContentType = "application/pdf"

    upl.sendbinary FILEPATH, True, "application/pdf", True
%>

In my case this is using AspUpload version 3.0.0.2 on a Hostway Windows 2003 Gold plan, shared hosting.

purchasing more downloads from Ireland VAT zone

About to suffer a little more pain than usual in renewing my Microsoft Action Pack subscription (note: don’t expect that link to display correctly in anything other than Microsoft Explorer). This year things have changed. Instead of everyone receiving physical media, we now have the option to download. Good for the environment.

Download users will pay the same pre-tax price as last year (£199) and physical media users will pay more (£273). But then there is VAT. We have different rates across the EU. In the UK the rate is currently 15%.

  • If you order physical media, you will pay the VAT for your region. In the UK, 15%.
  • If you order a download, you will pay the VAT for Ireland. 21.5%.

This really bugs me (accelerating me to grumpy-old-man status) and I have moaned about it before in relation to Adobe products. There must be some incentive or other good reasons for these companies to locate their online distribution services in Ireland. But they need to realise that they are costing many of their customers more by doing so.

I’m not sure if I should be moaning about the companies choice of country, or VAT and EU regulation in general. Greater minds than mine have argued against the VAT complexity in the past and failed to make any progress. So maybe time to give up, just get the extra 6.5% paid and go hit a punch-bag.

ms access more syntax error issues that aren’t

Continuing from yesterday’s strangeness…

Yesterday, my hosting provider found that the mdb file’s “write and modify permissions were missing”. Very odd! but since that was fixed my ASP scripts could now INSERT.

Today I have almost a repeat of the same symptoms, except this time I can still INSERT but cannot UPDATE. The error given is the same as yesterday i.e. a syntax error in the sql. The sql works fine when executed within the access application. The error number was the same as yesterday…

-2147217900, Syntax error in UPDATE statement

I followed the advice on this forum entry to switch the connection string from an OLE DB connection string to a basic Microsoft Access Driver string. i.e.

“Driver={Microsoft Access Driver (*.mdb)};
DBQ=D:\wwwroot\domain.com\database\database.mdb”

And this fixed it! I have a load of old sites out there still working happily with OLE DB connection strings to access databases. I’m not sure why this one has been so difficult.

when is a syntax error not a syntax error

Answer: When you are doing an INSERT INTO on an Access database which is read-only.

I’ve just been doing a bit of classic ASP with MS Access back-end database. I traditionally use the RecordSet object and AddNew to insert records. But thought I’d be good on this occasion and use Jet SQL and the Command Object. Unfortuantely the script broke with error:

Microsoft JET Database Engine error ‘80040e14’
Syntax error in INSERT INTO statement.

80040e14 is a fairly generic error code, with lots of possible causes. Just give it a google!

I checked and double-checked my SQL syntax, which looked fine. Even entering it directly into the Access application showed no problem. I then wrapped the code with the On Error Next, and an error trap which reported the following variation:

Error: -2147217900 Syntax error in INSERT INTO statement.

Same description, but googling the error number revealed just a few results, this amongst them suggesting a permissions problem. Which I didn’t quite believe at first, why would the hosting provider cause the mdb file to be read-only? It is in a folder outside the webroot, if I ask them for a SQLServer account, I’m sure it will allow me to insert records!

Replacing my code with my more traditional RecordSet object, AddNew and Update commands revealed and confirmed the error…

Microsoft JET Database Engine error ‘80040e09’
Cannot update. Database or object is read-only.

If I’d stuck with my old way of doing things I’d have saved a whole load of time spent looking in the wrong places.