Question
Error if page is left over night?
I get an error with my site if I leave it overnight and
return to it in
the morning. In normal use, the page works fine but if I leave the page
open over night, the session ends and if I hit refresh, I get an error.
I know this isn't a lot to go by but is there a way to check it? Is
there a way to check for the error and if it detects the error, it
forwards to the home page?
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'strCrumb'
/breadcrumb.inc, line 22
-------------------------------breadcrumb.inc
<%
function writeBreadCrumb(strCurrentCrumbTitle)
Dim strCrumb
Dim strXMLCrumb
Dim xmlDoc
Dim objCurrNode
Dim objAttrib
Dim objChild
Dim strLink
Dim strTitle
Dim strReqLink
set xmlDoc = server.createObject("Microsoft.XMLDOM")
strXMLCrumb = session("breadcrumbXML")
'Get currently requested page with variables
strReqLink = request.serverVariables("URL") & _
"?" & request.serverVariables("Query_String")
If strXMLCrumb = "" then
strCrumb = "<a href=""index.asp"">Home</a>" & _
" > "
strCrumb = strCrumb + strCurrentCrumbTitle
strXMLCrumb = "<Breadcrumb> " & vbcrlf & _
"<Page " & "Title=""" & _
strCurrentCrumbTitle & """ " & _
"Link=""" & strReqLink & """></Page>" & _
vbcrlf & "</Breadcrumb>"
session("breadcrumbXML") = strXMLCrumb
else
mDummy = xmlDoc.loadXML(strXMLCrumb)
do
if strCrumb = "" then
strCrumb = _
"<a href=""index.asp"">Home</a>" & _
" > "
Set objCurrNode = xmlDoc.FirstChild
end if
set objCurrNode = objCurrNode.firstChild
for each objAttrib in objCurrNode.attributes
if objAttrib.baseName = "Title" then
strTitle = objAttrib.text
end if
if objAttrib.baseName = "Link" then
strLink = objAttrib.text
end if
next
if strCurrentCrumbTitle = strTitle then
if objCurrNode.hasChildNodes() = true then
for each objChild in objCurrNode.childNodes
objCurrNode.removeChild objChild
next
end if
for each objAttrib in objCurrNode.attributes
if objAttrib.baseName = "Link" then
objAttrib.text = strReqLink
end if
next
strCrumb = strCrumb & strTitle
exit do
else
strCrumb = strCrumb & _
"<a href=""" & strLink & """>" & _
strTitle & "</a>" & " > "
if objCurrNode.hasChildNodes() = False then
set objChild = _
xmlDoc.createNode("element", "Page", "")
set objAttrib = _
xmlDoc.createAttribute("Title")
objAttrib.text = strCurrentCrumbTitle
set objAttrib = _
objChild.attributes.setNamedItem( _
objAttrib)
set objAttrib = xmlDoc.createAttribute( _
"Link")
objAttrib.text = strReqLink
set objAttrib = _
objChild.attributes.setNamedItem( _
objAttrib)
set objChild = objCurrNode.appendChild( _
objChild)
strCrumb = strCrumb & strCurrentCrumbTitle
exit do
else
'Do nothing
end if
end if
loop
session("breadcrumbXML") = xmldoc.xml
end if
response.write strCrumb
set xmlDoc = nothing
set objCurrNode = nothing
set objAttrib = nothing
set objChild = nothing
end function
%>
the morning. In normal use, the page works fine but if I leave the page
open over night, the session ends and if I hit refresh, I get an error.
I know this isn't a lot to go by but is there a way to check it? Is
there a way to check for the error and if it detects the error, it
forwards to the home page?
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'strCrumb'
/breadcrumb.inc, line 22
-------------------------------breadcrumb.inc
<%
function writeBreadCrumb(strCurrentCrumbTitle)
Dim strCrumb
Dim strXMLCrumb
Dim xmlDoc
Dim objCurrNode
Dim objAttrib
Dim objChild
Dim strLink
Dim strTitle
Dim strReqLink
set xmlDoc = server.createObject("Microsoft.XMLDOM")
strXMLCrumb = session("breadcrumbXML")
'Get currently requested page with variables
strReqLink = request.serverVariables("URL") & _
"?" & request.serverVariables("Query_String")
If strXMLCrumb = "" then
strCrumb = "<a href=""index.asp"">Home</a>" & _
" > "
strCrumb = strCrumb + strCurrentCrumbTitle
strXMLCrumb = "<Breadcrumb> " & vbcrlf & _
"<Page " & "Title=""" & _
strCurrentCrumbTitle & """ " & _
"Link=""" & strReqLink & """></Page>" & _
vbcrlf & "</Breadcrumb>"
session("breadcrumbXML") = strXMLCrumb
else
mDummy = xmlDoc.loadXML(strXMLCrumb)
do
if strCrumb = "" then
strCrumb = _
"<a href=""index.asp"">Home</a>" & _
" > "
Set objCurrNode = xmlDoc.FirstChild
end if
set objCurrNode = objCurrNode.firstChild
for each objAttrib in objCurrNode.attributes
if objAttrib.baseName = "Title" then
strTitle = objAttrib.text
end if
if objAttrib.baseName = "Link" then
strLink = objAttrib.text
end if
next
if strCurrentCrumbTitle = strTitle then
if objCurrNode.hasChildNodes() = true then
for each objChild in objCurrNode.childNodes
objCurrNode.removeChild objChild
next
end if
for each objAttrib in objCurrNode.attributes
if objAttrib.baseName = "Link" then
objAttrib.text = strReqLink
end if
next
strCrumb = strCrumb & strTitle
exit do
else
strCrumb = strCrumb & _
"<a href=""" & strLink & """>" & _
strTitle & "</a>" & " > "
if objCurrNode.hasChildNodes() = False then
set objChild = _
xmlDoc.createNode("element", "Page", "")
set objAttrib = _
xmlDoc.createAttribute("Title")
objAttrib.text = strCurrentCrumbTitle
set objAttrib = _
objChild.attributes.setNamedItem( _
objAttrib)
set objAttrib = xmlDoc.createAttribute( _
"Link")
objAttrib.text = strReqLink
set objAttrib = _
objChild.attributes.setNamedItem( _
objAttrib)
set objChild = objCurrNode.appendChild( _
objChild)
strCrumb = strCrumb & strCurrentCrumbTitle
exit do
else
'Do nothing
end if
end if
loop
session("breadcrumbXML") = xmldoc.xml
end if
response.write strCrumb
set xmlDoc = nothing
set objCurrNode = nothing
set objAttrib = nothing
set objChild = nothing
end function
%>
