Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re-direct question

Status
Not open for further replies.

bmacman

IS-IT--Management
Feb 19, 2001
51
US
I have a question and I hope that it makes sense. As a user is entering our Intranet site, they are briefly re-directed to a page on another server that logs certain information about the user such as browser type and version, IP address, OS, ect. into an access database and then they are re-directed back to the home page of the intranet site. The possible problem with this is that there is a slight possibility that the server where we have the Access database might become unavailable and therefore the Intranet sight becomes unaccessable. My question is, Is there some kind of error checking routine in CF (such as CFTry/Catch... I do not know if this will work for what I need it to do) that will allow me to not re-direct if the server becomes unavailable. Any help would be greatly appreciated.

Thanks
B
 
Hi bmacman: This may help.
<cfset error=false>
<cftry>
<cfquery name=&quot;abc&quot; datasource=&quot;Your DB&quot;>
SELECT whatever
FROM whatever
WHERE user_id=#form.user_id#
AND version=#form.version#
AND os=#form.os#
AND ...=#form....#
</cfquery>
<cfcatch type=&quot;DATABASE&quot;>
<cfoutput>
<P>Caught an exception, type = #CFCATCH.TYPE# </P>
<P>#CFCATCH.message#</P>
<P>#CFCATCH.NativeErrorCode#</P>
<P>#CFCATCH.SQLSTATE#</P>
<cfset error=true>
</cfoutput>
</cfcatch>
<cfcatch type=&quot;Any&quot;>
<cfoutput>
<P>Caught an exception, type = #CFCATCH.TYPE# </P>
<P>#CFCATCH.message#</P>
</cfoutput>
</cfcatch>
</cftry>
<cfif error>
Stay somewhere you want.
<cfelse>
<cflocation url=yourwebsite.com>
</cfif>
Hope it help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top