BC30451: 'MailValidation' is not declared. It may be inaccessible due to its protection level
Asked Answered
T

1

1

I am using this code in my aspx file:

<%MailValidation(Email.Text)%>
   <asp:RegularExpressionValidator runat="server" ID="RegExpValidator" CssClass="failureNotification" ControlToValidate="Email"
   ValidationGroup="RegisterUserValidationGroup">*</asp:RegularExpressionValidator>

And also I have the following in my code behind:

Public Sub MailValidation(mail As String)
        'Dim retVal As String
        Dim s As Internet = New Internet
        If mail = "" Then
            RegExpValidator.ErrorMessage = Nothing
            RegExpValidator.Enabled = False
            GoTo endthis
        End If
        Dim boolVal As Boolean = IsValidEmail(mail)
        RegExpValidator.Enabled = True
        If Internet._error <> "True" Then
            RegExpValidator.ErrorMessage = Internet._error
        ElseIf Internet._error = "True" Then
            RegExpValidator.ErrorMessage = Nothing
            RegExpValidator.Enabled = False
        End If

endthis:
    End Sub

When I run the project in Debugging mode everything goes fine. But when I pass the code to the ISP server and trying to run this page throw me the error:
BC30451: 'MailValidation' is not declared. It may be inaccessible due to its protection level

Additional Update
Looking in Client site, while I'm running from my ISP server, the aspx file don't see the code behind file at all. This issue I don't have it when I'm running the project from my computer (in debugging mode).

<asp:Content ID="LeftNav" ContentPlaceHolderID="LeftNavigationHolder" runat="server">
    <div class="LeftNavDiv">
<span class="failureNotification">
 <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
 </span>
    <asp:Panel ID="LeftSitePanel" CssClass="LeftSitePanel" runat="server" ScrollBars="Vertical">
      <asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification" 
                             ValidationGroup="RegisterUserValidationGroup"/>
                            <fieldset class="RegisterArea">
                                <legend>Στοιχεία χρήστη</legend>
    .........
    </fieldset>
    <div class="submitButton">
       <asp:Button ID="SetUserButton" runat="server" CommandName="MoveNext" Text="Καταχώρηση" 
       ValidationGroup="RegisterUserValidationGroup" TabIndex="10"  />
    </div>
    </asp:Panel>
 </div>
</asp:Content>
Topnotch answered 4/12, 2013 at 21:9 Comment(0)
T
-1

I made some changes in my web.config file and the problem was solved
I just add lines in <assembly> and in <namespace>
What is teaching this?
when we have issues between debugging mode in our computer and ISP server then the problem comes (most of the times) from the configuration file we.config.

Topnotch answered 5/12, 2013 at 17:5 Comment(2)
Hi Lefteris. Would you care to edit this answer with a snip of code you used to do this? I can find neither <assembly> nor <namespace> in my Web.config file.Motorcycle
@jp2code Sorry... this topic is extrimelly old I can't even find the source code in my computer any more. You see now I'm working in MVC5 environment and everything are much betterTopnotch

© 2022 - 2024 — McMap. All rights reserved.