Compiler Error Message: BC30451: Name 'check' is not declared. RRS feed

  • Question

  • User-1008348326 posted


    I get an strange error when i running this code without compiling in advance:

    Compilation Error
    Compiler Error Message: BC30451: Name 'check' is not declared.

    But if i compile it with this command: aspnet_compiler -p "c:\inetpub\wwwroot\resintra" -v / c:\compiled\resintra -f
    then it works without any error. And when i run it in Visual Web Developer (with Cassini), it works too.

    I use a shared procedure for checking whether a user is registrated or not (i don't use login control).

    Imports Microsoft.VisualBasic

    Public Class check
        Public Shared Sub beh()
            Dim cok As HttpCookie
            Dim ja, jv As String
            cok = HttpContext.Current.Request.Cookies("ok")
            ja = cok.Value
            If ja <> "1" Then
                jv = "<script language='javascript'>" _
                   & " alert('You must first registrate');" _
                   & " window.location.href='start.aspx';" _
                   & "</script>"
            End If
        End Sub
    End Class

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


    Any idea?

    Thanks T.

    Friday, November 7, 2008 5:33 PM

All replies

  • User-1939929478 posted

     check is a class and it needs to be compiled with the project/website before it can be recognized by it.

    Visual Web Developer is probably working because it is automatically compliling before running your app. If you want the same out of visual studio, then:

    go to 'Website' (from the top menu in Visual Studio)

    Click 'Start Options'

    Select 'Build'

    In the dropdown for 'Start Action', Select 'Build Web Site' , and hit 'Apply'


    This will ensure that every time you run your project, the website will compile first.

    Friday, November 7, 2008 6:24 PM