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

ε祈祈猫儿з 提交于 2019-12-23 02:47:12

问题


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>

回答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.



来源:https://stackoverflow.com/questions/20386011/bc30451-mailvalidation-is-not-declared-it-may-be-inaccessible-due-to-its-pro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!