<asp:TextBox ID="Email" runat="server" ValidationGroup="register" Placeholder="Email" Width="250px" CausesValidation="true" required="true" MaxLength="200"></asp:TextBox>
<asp:RegularExpressionValidator ID="revEmailAddress" runat="server" SetFocusOnError="true" Display="Dynamic" ControlToValidate="Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="register" ForeColor="Red">Please enter a valid email address.</asp:RegularExpressionValidator>
如果我在Visual Studio中测试以上代码,则验证器可以正常工作,但是一旦我发布了项目,验证就只会在我提交无用的表单之后进行。为什么验证在发布后不起作用?