我继承了一个在 VB Studio 中构建的网站,我试图让表单在这个页面上工作:http ://childplus.com/Support/我在不同用户的不同浏览器中遇到了很多 500 错误表格。我只想要工作表格!
到目前为止,无论浏览器如何,单击提交按钮后都会返回 500 错误。但是,我对使用 VB Studio 开发 Web 表单还是很陌生。任何有关为新手调试和修复 500 错误的见解或说明将不胜感激。
页面上的实际表格:
<form id="form_support" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<!--Name-->
<div class="FormLine">
<asp:Label ID="lblName" runat="server" Text="Name:" CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:TextBox ID="FullName" runat="server" class="TxtBox" TabIndex="1" MaxLength="100"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValFullname" runat="server" ControlToValidate="FullName" ToolTip="Name is Required" EnableClientScript="False" SetFocusOnError="true"></asp:RequiredFieldValidator>
</div>
<!--Agency-->
<div class="FormLine">
<asp:Label ID="lblAgency" runat="server" Text="Agency:" CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:TextBox ID="AgencyName" runat="server" class="TxtBox" TabIndex="2" MaxLength="100"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValAgencyName" runat="server" ControlToValidate="AgencyName" ToolTip="Agency is Required" EnableClientScript="False" SetFocusOnError="true"></asp:RequiredFieldValidator><br />
</div>
<!--Email-->
<div class="FormLine">
<asp:Label ID="lblemail" runat="server" Text="Email:" CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:TextBox ID="email" runat="server" class="TxtBox" TabIndex="3" MaxLength="100"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValEmail" runat="server" ControlToValidate="email" ToolTip="Email is Required" EnableClientScript="False"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator Display="Static" ID="RegularExpressionValEmail" ErrorMessage="Email is not valid." ControlToValidate="email" runat="server" ToolTip="Email is not valid." ValidationExpression="^(['_a-z0-9-]+)(\.['_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,5})$"></asp:RegularExpressionValidator>
</div>
<!--Phone-->
<div class="FormLine">
<asp:Label ID="lblPhone" runat="server" Text="Phone:" CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:TextBox ID="phone" runat="server" class="TxtBox" TabIndex="4" MaxLength="30"></asp:TextBox>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValPhone" runat="server" ControlToValidate="phone" ToolTip="Phone is Required" EnableClientScript="False" SetFocusOnError="true"></asp:RequiredFieldValidator><br />
</div>
<!--Subject-->
<div class="FormLine">
<asp:Label ID="lblSubject" runat="server" Text="Subject:" CssClass="Txt"></asp:Label><p class="required">(required)</p>
<asp:DropDownList ID="ddlSubject" runat="server" class="TxtBox1" TabIndex="5"></asp:DropDownList>
<asp:RequiredFieldValidator Display="Static" ID="RequiredFieldValddlSubject" runat="server" ControlToValidate="ddlSubject" ToolTip="Subject is Required." InitialValue="" EnableClientScript="False"></asp:RequiredFieldValidator>
</div>
<!--Topic-->
<div class="FormLine">
<span class="Txt">Topic:</span>
<asp:DropDownList ID="ddlTopic" runat="server" class="TxtBox1" TabIndex="6"></asp:DropDownList>
<asp:CascadingDropDown ID="CascadingDropDown1" runat="server" TargetControlID="ddlSubject" Category="subject" prompttext="Select a Subject..." ServicePath="~/wbSubjectTopics.asmx" ServiceMethod="GetDropDownContents">
</asp:CascadingDropDown>
<asp:CascadingDropDown ID="CascadingDropDown2" runat="server" TargetControlID="ddlTopic" Category="topic" prompttext="Select a Topic..." LoadingText="Loading..." ParentControlID="ddlSubject" ServicePath="~/wbSubjectTopics.asmx" ServiceMethod="GetDropDownContents">
</asp:CascadingDropDown>
</div>
<!--Details-->
<div class="FormMultiLine">
<span class="Txt2">Please include as much detail as possible including:</span>
<ul>
<li>What steps you did.</li>
<li>Your computer's operating system.</li>
<li>Exact text of any error message.</li>
</ul>
<asp:TextBox ID="Comments" class="TxtBoxMulti" runat="server" TextMode="MultiLine" TabIndex="7" ></asp:TextBox>
</div>
<!--Submit-->
<div id="SubBtnWrapper" class="SubBtnBlue">
<asp:LinkButton ID="SubBtn" text="" title="Submit" runat="server" TabIndex="8">
<div class="rollover_wrapper"><div class="submit_rollover"><img src="../../Images/Forms/submit_btn_blue.png" height="78px" width="79px" /></div></div>
</asp:LinkButton>
</div>
<script type="text/javascript" language="JavaScript"><!-- document.form_support.FullName.focus(); //--></script>
</form>
</div>
代码隐藏:通用进口
Partial Public Class Support_homepage
Inherits System.Web.UI.Page
Public Utils As Utils = New Utils
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub ddlSubject_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ddlSubject.SelectedIndexChanged
ddlTopic.SelectedIndex = -1
End Sub
Private Sub SubBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubBtn.Click
Page.Validate()
If (Page.IsValid) Then
Dim EmailBody As String
Dim strSubjectTopic As String
If ddlTopic.SelectedValue = "" Then
strSubjectTopic = ddlSubject.SelectedValue
Else
strSubjectTopic = ddlTopic.SelectedValue
End If
EmailBody = "<p style=" + "font-family:Verdana;" + "><strong>Technical Support Request:</strong></p><p style=" + "font-family:Verdana;" + "><strong>Name:</strong> " + FullName.Text + "</p>"
EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Email:</strong> " + email.Text + "</p>"
EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Phone:</strong> " + phone.Text + "</p>"
EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Agency:</strong> " + AgencyName.Text + "</p>"
EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Subject/Topic:</strong> " + strSubjectTopic + "</p>"
EmailBody = EmailBody + "<p style=" + "font-family:Verdana;" + "><strong>Comments:</strong> " + Comments.Text + "</p>"
Utils.SendAppNotificationEmails("support@childplus.com", "support@childplus.com", "Website: Technical Support Request", EmailBody)
Response.Redirect("/")
Else
If RequiredFieldValFullname.IsValid Then
lblName.CssClass = "Txt"
Else
lblName.CssClass = "ErrorTxt"
End If
If RequiredFieldValAgencyName.IsValid Then
lblAgency.CssClass = "Txt"
Else
lblAgency.CssClass = "ErrorTxt"
End If
If RequiredFieldValPhone.IsValid Then
lblPhone.CssClass = "Txt"
Else
lblPhone.CssClass = "ErrorTxt"
End If
If RequiredFieldValEmail.IsValid Then
lblemail.CssClass = "Txt"
Else
lblemail.CssClass = "ErrorTxt"
End If
If RequiredFieldValddlSubject.IsValid Then
lblSubject.CssClass = "Txt"
Else
lblSubject.CssClass = "ErrorTxt"
End If
End If
End Sub
End Class
这是堆栈跟踪:
Server Error in '/' Application.
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +8644665
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +69
System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection) +53
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +343
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743