Support

>  FAQ
>  Documentation
>  Ask Us!

 

Free Tools

>  Free Components
>  Free Sourcecode
>  IIS Development

 

Service

>  Über uns
>  Referenzen
>  Kontaktinformationen
>  Anfrageformular

Home | Support Central | About Us  

FAQ: What causes error 406 in conjunction with the Save method

When you download a binary document from a Web server using the Save method, you might encounter server error 406. This means that the server cannot return the document in the requested format - that is, AspTear requested it in text/html (default), which cannot be fulfilled for example for Adobe PDF documents.

To circumvent the problem, set the Accept property to */* so the Web server can choose the right format to send. See the below source code for an example of how to implement the solution.

<% @LANGUAGE=VBSCRIPT %>
<%
Dim xObj, strUrl, bDoneSuccessfully, strFile
Const Request_GET = 2

Set xobj = CreateObject("SOFTWING.ASPtear")
   
On Error Resume Next
xObj.ForceReload = True

strUrl = Request.ServerVariables("SCRIPT_NAME")
strUrl = "http://192.168.1.156/somedocument.pdf"

strFile = Server.MapPath("mydocument.pdf")

xobj.Accept = "*/*"
bDoneSuccessfully = xobj.Save(strUrl, Request_GET , "", strFile, "", "")
Response.Write "<b>" & Err.Description &   " " & Err.Number & _
	"</b><br>" & vbCrlf
Response.Write "<pre>" & xobj.Headers & "</pre>"
%>

 
 
© 1999-2021 AlphaSierraPapa. All Rights Reserved.
Back to the top.