ekolis
ekolis

Reputation: 6806

Phantom VB errors in an ASPX file

I have an aspx file containing some VB code:

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="XXX.Email" %>
<%@ Import Namespace="XXX.Functions" %>
<%@ Import Namespace="XXX.Rtf" %>
<%@ Import Namespace="XXXDBTools" %>
<%@ Import Namespace="XXXDBTools.DBFunctions" %>
<%@ Import Namespace="XXXStrTools.StrFunctions" %>

<script runat="server">
Dim strToResult
Dim errorMessage
Dim errorMessageFor
Dim referralEmailStr

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    ...
End Sub
</script>
<html>
<head>
    <title><%=Request.Cookies("State").Value%> Request a Placement</title>
    ...
</head>
...
</html>

Now I see compile errors on the Request.Cookies("State").Value line, for code that doesn't even exist on this page!

enter image description here

If I delete the line where I'm checking for the state cookie, I still get the same errors, but at the end of the Sub Page_Init I declared above.

The variables mentioned in the errors (such as myTemp and lfyCompanyInfoDSN) do not even exist on this page, so I'm perplexed as to how I could be getting these errors...

Upvotes: 0

Views: 24

Answers (1)

ekolis
ekolis

Reputation: 6806

Turns out at the very bottom of the <html> tag I had some lines such as this in a script:

set drIntakeWorker = Nothing

Which is not valid because the set keyword is not allowed in VB.NET. Somehow this error was percolating up and screwing up the entire page...

Upvotes: 0

Related Questions