Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Issue with xmlhttp
Message
 
 
À
24/11/2008 17:05:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01363859
Message ID:
01363860
Vues:
25
>Have been using xmlhttp to get shipping rates from UPS. Now want to detect case where client is not connected to internet so can handle gracefully. If disconnect from Internet and run program, get error 0 at lcxml =oxmlhttp.responsetext statement below. Tried to intercept with on error, but success seems to depend on whether am in debugger or not.
>
>How can I best detect user is not connected to internet using the xmlhttp object? Thanks.
>
>
>oXMLHttp = CREATEOBJECT("Microsoft.xmlhttp")
>oXMLHttp.open("POST", "https://wwwcie.ups.com/ups.app/xml/Rate", .T.)
>oXMLHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
>xx=alltrim(holdxml.holdxml)  && this is a memo field in the holdxml table which holds the request string
>oXMLHttp.send(xx)
>lcxml=oxmlhttp.responsetext
>**11-24-08 intercept error with on error()
>IF problem  && connecting to internet
>	**handle the problem
>else
>	= XMLTOCURSOR(lcxml,"")  && transfer xml return to xmlresult cursor
>	*etc.
>endif
>
David,

Try to test Internet connection with Re: Am I online? Thread #1007183 Message #1007240 Also use TRY/CATCH with your code.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform