BC30081: 'If' must end with a matching 'End If'.

W

William

The script below runs correctly in ASP but not ASPX. Im not sure why?
Please help.

Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30081: 'If' must end with a matching 'End If'.

Source Error:



Line 3: 'Written by David Addison 207-347-7360
Line 4: 'Set Session ID for each visitor to the site.
Line 5: if Request.Cookies("SID") = "" then
Line 6: if Session("SID") = "" then
Line 7: Function CreateGUID()


<%
'Set Session ID for each visitor to the site.
if Request.Cookies("SID") = "" then
if Session("SID") = "" then
Function CreateGUID()
Dim oTypeLib, sGUID
set oTypeLib = Server.CreateObject("Scriptlet.Typelib")
sGUID = oTypeLib.GUID
sGUID = LCase(sGUID)
sGUID = Mid(sGUID, 1, Len(sGUID) - 2)
Set oTypeLib = Nothing
CreateGUID = sGUID
End Function
Response.Cookies("SID")=CreateGUID
Response.Cookies("SID").Expires = Date + 365
Session("SID") = CreateGUID
end if
end if
if Request.Cookies("SID") <> "" then
if Session("SID") = "" then
Session("SID") = Request.Cookies("SID")
end if
end if
if Session("SID") <> "" then
if Request.Cookies("SID") = "" then
Response.Cookies("SID") = Session("SID")
Response.Cookies("SID").Expires = Date + 365
end if
end if
'Set Tracking Variables for each visitor to the site.
if LEN(session("id")) < 1 then
if LEN(Request.QueryString("id")) <> 0 then
if LEN(Request.Cookies("id")) < 1 then
Session("id") = Request.QueryString("id")
Response.Cookies("id")=Request.QueryString("id")
Response.Cookies("id").Expires = Date + 365
Session("keywords") = Request.QueryString("keywords")
Response.Cookies("keywords")=Request.QueryString("keywords")
Response.Cookies("keywords").Expires = Date + 365
Session("campaignno") = Request.QueryString("campaignno")
Response.Cookies("campaignno")=Request.QueryString("campaignno")
Response.Cookies("campaignno").Expires = Date + 365
Session("adgroup") = Request.QueryString("adgroup")
Response.Cookies("adgroup")=Request.QueryString("adgroup")
Response.Cookies("adgroup").Expires = Date + 365
end if
end if
end if
if LEN(Request.Cookies("id")) <> 0 then
Session("id") = Request.Cookies("id")
Session("keywords") = Request.Cookies("keywords")
Session("campaignno") = Request.Cookies("campaignno")
Session("adgroup") = Request.Cookies("adgroup")
end if
'Set session Referring URL, IP, Broswer Type so that it can be captured with
order.
if LEN(Session("referer")) < 1 then
Session("referer") = Request.ServerVariables("HTTP_REFERER")
Session("scriptname") = Request.ServerVariables("SCRIPT_NAME")
Session("useragent") = Request.ServerVariables("HTTP_USER_AGENT")
Session("remotehost") = Request.ServerVariables("REMOTE_HOST")
end if
%>
 
G

Guest

You cannot declare a function inside an if statement (orinside another
function for that matter). You should probably review OO basics.

Jason Lind
 
K

Kevin Spencer

You should probably review OO basics.

Heck, Jason, that isn't even OO basics! It's plain programming basics!
Perhaps he's used to ActionScript, which seems to play fast and loose with
those sorts of rules.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top