-1
我繼承了使用VB Studio構建的網站,我試圖讓表單在本頁面上工作:http://childplus.com/Support/我在所有窗體上的不同用戶的不同瀏覽器中發生了大量500錯誤。我只是想要工作表單!如何調試此表單上的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("[email protected]", "[email protected]", "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
嘗試發佈一些實際上會導致500錯誤的代碼。 – Tariqulazam
@Tariqulazam,我添加了頁面的表單和代碼隱藏。 – Tamara
可否請您詳細說明錯誤詳情以及堆棧跟蹤? – Tariqulazam