Search Persits Software Knowledge Base

 

Article PS150922185

Error opening URL. HTTP Status Code: 500

Problem Description

During HTML-to-PDF conversion with AspPDF or AspPDF.NET, a call to the ImportFromUrl method generates the following error:

Persits.PdfManager.1 error '800a006a'
Error opening URL. HTTP Status Code: 500.

although the same URL as the one being imported works well when opened directly in the browser.

Solution

This error usually occurs because the URL being imported by ImportFromUrl has generated a run-time script error.

The script's reliance of session variables is often the culprit as the content of session variables is not preserved when the script is invoked via ImportFromUrl. Therefore, a code snippet such as

SQL = "select * from mytable where id = " & Session("id") myRecorset.Open SQL, myConnection

is bound to generate a run-time script error as Session("id") becomes empty thus rendering the SQL statement syntactically incomplete and causing the myRecordset.Open method to fail.

Another example is a session variable containing an object. The line

Set myObject = Session("myObject")

by itself causes a run-time script error as an object cannot be initialized from an empty variable.

Methods other than session variables should be used to pass data from a script calling ImportFromUrl to the script being imported, such as URL parameters, for example:

Doc.ImportFromUrl "http://www.server.com/script.asp?id=15"

Created: 9/22/2015 1:22:53 PM
Last Modified: 9/22/2015 1:25:26 PM

Copyright © Persits Software, Inc. 1998 - 2017
For technical support, write to support@persits.com.