asp.net : 잘못된 포스트백 또는 콜백 인수
다음 오류가 발생했습니다.
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) +8627417
System.Web.UI.WebControls.ListBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +360
System.Web.UI.WebControls.ListBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +346
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618
그것은 무엇을 뜻하나요?
내 코드는 다음과 같습니다.
<%@ Page EnableEventValidation="true" Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="EnterData.DataEntry.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js" type="text/javascript"></script>
<link href="../niceforms/niceforms-default.css" rel="stylesheet" type="text/css" />
<script src="../niceforms/niceforms.js" type="text/javascript"></script>
<link href="../jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.list-problems {
height:600px !important;
width:200px !important;
display:inline-block;
}
</style>
<script>
jQuery(function($) {
//$("#occurrence_dateTextBox").mask("99/99/9999");
//$("#<%= report_dateTextBox.ClientID %>").mask("99/99/9999");
$("#<%= occurrence_dateTextBox.ClientID %>").datepicker();
$("#<%= report_dateTextBox.ClientID %>").datepicker();
//$(".datepicker").datepicker();
});
$(function() {
$.get('../file.txt', function(data) {
var output = data.split('\n'),
tmp = '';
for (i = 0; i < output.length; i++) {
tmp += '<option value=' + output[i] + '>' + output[i] + '</option>';
}
$('#lstProblems').html(tmp);
});
});
$(function() {
$("select").multiselect();
});
function getselectedproblems() {
var selectedLanguages = new Array();
jQuery('#lstProblems option:selected').each(function() {
selectedLanguages.push(jQuery(this).val());
});
}
</script>
</head>
<body><div id="container">
<form id="form1" runat="server" class="niceform">
<fieldset>
<legend>Section A</legend>
<dl>
<dt><label for="occurrence_dateTextBox" >Occurrence Date:</label></dt>
<dd><asp:TextBox ID="occurrence_dateTextBox" runat="server" size="50"/></dd>
</dl>
<dl>
<dt><label for="report_dateTextBox">Report Date:</label></dt>
<dd><asp:TextBox ID="report_dateTextBox" runat="server" size="50"/></dd>
</dl>
<dl>
<dt><label for="spec_idTextBox">Specimen ID:</label></dt>
<dd><asp:TextBox ID="spec_idTextBox" runat="server" size="50"/></dd>
</dl>
<dl>
<dt><label for="batch_idTextBox">Batch ID:</label></dt>
<dd><asp:TextBox ID="batch_idTextBox" runat="server" size="50"/></dd>
</dl>
<dl>
<dt><label for="report_byTextBox">Report By:</label></dt>
<dd><asp:TextBox ID="report_byTextBox" runat="server" size="50"/></dd>
</dl>
<dl>
<dt><label for="identified_byTextBox">Identified ID:</label></dt>
<dd><asp:TextBox ID="identified_byTextBox" runat="server" size="50"/></dd>
</dl>
</fieldset>
<fieldset>
<legend>Section B</legend>
<dl>
<dt><label for="problemTextBox">Problem:</label></dt>
<dd><asp:TextBox ID="problemTextBox" runat="server" size="50"/></dd>
</dl>
<dl>
<dt><label for="lstProblems">Problems List:</label></dt>
<dd>
<asp:ListBox ID="lstProblems" runat="server" SelectionMode="Multiple" CssClass="list-problems"></asp:ListBox>
</dd>
</dl>
<dl>
<dd><select size="8" multiple="true" >
<optgroup label="Europe">
<option>United Kingdom</option>
<option>Luxembourg</option>
</optgroup>
<optgroup label="Asia">
<option>India</option>
<option>Dubai</option>
</optgroup>
</select> </dd>
</dl>
<dl>
<asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource1"
DataTextField="batch" DataValueField="batch" SelectionMode="Multiple"
Height="100px" Width="329px"></asp:ListBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:LOM %>"
SelectCommand="SELECT [batch] FROM [lom_batch]"></asp:SqlDataSource>
</dl>
</fieldset>
<fieldset>
<legend>Section C</legend>
<dl>
<dt><label for="section_c_issue_error_identified_byTextBox">Issue/Error Identified By:</label></dt>
<dd><asp:TextBox ID="section_c_issue_error_identified_byTextBox" runat="server" size="50"/></dd>
</dl>
<dl>
<dt><label for="section_c_commentsTextBox">Comments:</label></dt>
<dd><asp:TextBox ID="section_c_commentsTextBox" runat="server" size="50"/></dd>
</dl>
</fieldset>
<fieldset>
<legend>Section D</legend>
<dl>
<dt><label for="section_d_investigationTextBox">Investigation:</label></dt>
<dd><asp:TextBox ID="section_d_investigationTextBox" runat="server" size="50"/></dd>
</dl>
</fieldset>
<fieldset>
<legend>Section E</legend>
<dl>
<dt><label for="section_e_corrective_actionTextBox">Corrective Action:</label></dt>
<dd><asp:TextBox ID="section_e_corrective_actionTextBox" runat="server" height="200" TextMode="MultiLine" size="50"/></dd>
</dl>
</fieldset>
<fieldset>
<legend>Section F</legend>
<dl>
<dt><label for="section_f_commentsTextBox">Comments:</label></dt>
<dd><asp:TextBox ID="section_f_commentsTextBox" runat="server" size="50"/></dd>
</dl>
</fieldset>
<fieldset>
<legend>Pre-Analytical</legend>
<dl>
<dt><label for="prePracticeCodeTextBox">Practice Code:</label></dt>
<dd><asp:TextBox ID="prePracticeCodeTextBox" runat="server" Visible="false"/></dd>
</dl>
<dl>
<dt><label for="preContactTextBox1">Contact:</label></dt>
<dd><asp:TextBox ID="preContactTextBox" runat="server" Visible="false"/></dd>
</dl>
<dl>
<dt><label for="CheckBox1">PreAnalytical?</label></dt>
<dd> <asp:CheckBox ID="CheckBox1" runat="server" CausesValidation="false"
Visible="true" AutoPostBack="true" OnCheckChanged="CheckBox1_CheckedChanged"/></dd>
</dl>
</fieldset>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="SubmitData" OnClientClick="JSfunction()"/>
</form>
</div></body>
</html>
내가 뭘 잘못하고 있는 거지?
제출 버튼을 누른 후 이 오류가 발생합니다.
asx 파일에서 첫 번째 줄을 다음과 같이 입력해야 합니다.
<%@ Page EnableEventValidation="false" %>
당신이 이미 가계분들은신고 같은 .<%@ Page
그러니 나머지만 더하세요 =>EnableEventValidation="false" %>
저는 그것을 하지 않는 것을 추천합니다.
텍스트의 첫 줄을 보면 오류가 무엇인지 알 수 있습니다.
이 기능은 포스트백 또는 콜백 이벤트에 대한 인수가 원래 이벤트를 렌더링한 서버 컨트롤에서 발생하는지 확인합니다.
ASP를 다시 게시할 때 문제 목록 드롭다운을 동적으로 편집하는 중입니다.NET은 "경고!드롭다운에 잘못된 항목이 있습니다!"라는 메시지가 표시되고 오류가 발생합니다.이벤트 유효성 검사를 해제하는 것이 괜찮은 해결책인지 결정해야 하지만, 그 뒤에 있는 아이디어는 무료로 당신의 사이트를 더 안전하게 만드는 것이기 때문에 저는 그것을 하기 전에 그것을 조사하고 싶습니다.
잘못된 포스트백 또는 콜백 인수인 나보다 훨씬 더 잘 설명하는 스택 오버플로 답변이 있습니다. 이벤트 유효성 검사는 '<pages enableEventValidation="true"/>를 사용하여 활성화됩니다.
Page_Load() 이벤트에 코드가 있는 경우.다음을 추가해 보십시오.
if (!Page.IsPostBack)
{
//your code here
}
주의해야 할 또 다른 점은 중첩된 경우 이 오류가 발생할 수 있다는 것입니다.
<form
태그를 지정합니다.넷폼.
데이터 목록에서 동일한 문제가 발생했습니다. 동적 바인딩입니다. EnableViewState="false"를 추가하면 오류 메시지가 사라집니다.제가 프로그래밍 방식으로 바인딩하고 있다면, 컨트롤이 각 포스트백에 채워지고, 각 콜백에서 변경될 수 있거나 변경되지 않을 수 있다면 보기 상태가 유지될 필요가 없다는 것을 알게 됩니다. 그래서 동적으로 바인딩하고 있습니다. 하하.
이 오류는 중첩된 경우에도 발생할 수 있습니다.<form>
허용되지 않는 마스터 페이지의 태그입니다.
<form id="someid"></form>
템플릿을 선택하여 어딘가에서 코드를 복사한 경우 이 문제가 발생할 수 있습니다.
해결책
당신은 당신의 보금자리를 깨야 합니다.<form>
tag.은 그태가 되어야 . 다음이 되어야 합니다.
<form method="" name="form1">
<form method="" name="form2>
</form>
</form>
가 되어야 합니다
<form method="" name="form1">
</form>
<form method="" name="form2>
</form>
맨 위에 추가
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//Code display data
}
}
변하면UseSubmitBehavior="True"
UseSubmitBehavior="False"
당신의 문제는 해결될 것입니다.
<asp:Button ID="BtnDis" runat="server" CommandName="BtnDis" CommandArgument='<%#Eval("Id")%>' Text="Discription" CausesValidation="True" UseSubmitBehavior="False" />
아, 안타깝네요.당신이 그것들을 기본적으로 추가하기 때문에 asp.net 은 폭발합니다.또한 드롭다운 상자에 악의적으로 주입하는 등 도움이 되는 몇 가지 중요한 보호 기능이 있으므로 EventValidation을 해제해야 하는 경우도 있습니다.또 다른 대안은 자신만의 복합 제어 장치를 만드는 것입니다. 물론 여기서 말하는 것은 관련된 노력 이상의 것으로 보입니다.이벤트 유효성 검사도 끌 수 있지만 숨겨진 키, 콤보 상자를 통한 SQL 주입 등 단순히 변경함으로써 잘못된 방식으로 사용될 수 있는 페이지의 값을 신뢰하지 않도록 매우 주의해야 합니다.
프레렌더 이벤트에서 데이터를 채울 수도 있습니다.이렇게 하면 유효성 검사를 유지하고 보안을 유지할 수 있습니다.다음은 리피터를 사용한 예입니다.
protected void Page_PreRender(object sender, EventArgs e)
{
List<Objects.User> users = Application.User.GetAllUsers();
Repeater1.DataSource = users;
Repeater1.DataBind();
}
제 솔루션은 다음을 추가하는 것이었습니다.
ctlUpdatePanel.Update();
포스트백 후 바인딩 제어 후.UpdateMode="Conditional" 특성이 있는 업데이트 패널에 있습니다.
로컬 개발 워크스테이션이 아닌 원격 서버(운영, 테스트, QA, 스테이징 등)에서 이 문제가 발생한 후 Application Pool이 0이 아닌 RequestLimit으로 구성되었습니다.
이로 인해 앱 풀이 포기되고 질문에 명시된 예외와 함께 응답합니다.
제 installshield 프로젝트가 진행되는 도중에 앱 풀 정의가 "3"(아마도 잘못 클릭했거나 잘못 입력한 것일 수 있음)을 사용하도록 변경되었습니다.
ViewStateMode="Disabled"를 추가할 수 있습니다.
asp:UpdatePanel ID="UpdatePanel1"이 ="server" ViewStateMode="Disabled"에서 실행됨
저도 똑같은 문제가 있었습니다. 목록 상자 두 개와 단추 두 개입니다.
목록 상자의 데이터를 데이터베이스에서 로드하는 중이었고 단추를 클릭하여 항목을 상자 간에 이동할 수 있습니다.
저는 잘못된 우편물을 받고 있었습니다.
목록 상자에 표시할 때 볼 수 없는 캐리지 리턴 라인 피드가 데이터에 포함된 것으로 나타났습니다.
IE 10과 IE 11을 제외한 모든 브라우저에서 잘 작동했습니다.
캐리지 리턴 라인 피드를 제거하면 모두 정상적으로 작동합니다.
이것은 아마도 당신의 문제의 원인이 아닐 것입니다. 하지만 저는 당신이 드롭다운에서 optgroups를 사용하고 있다는 것을 알았기 때문에 누군가가 이 문제로 여기에 오게 되면 도움이 될 것이라고 생각했습니다.저는 optgroups로 렌더링할 드롭다운 목록을 만들어야 했고, 여기서 승인된 답변을 사용하게 되었지만 컨트롤을 올바르게 렌더링하는 동안 오류가 발생했습니다.제가 어떻게 그것을 통과했는지는 여기 제 대답에 자세히 나와 있습니다.
다른 페이지의 복사 붙여넣기 때문에 비슷한 문제가 발생했습니다.
<form id="form1" runat="server">
...
<form id="form2" runat="server">
....
</form>
</form>
방금 ID="form2" 인 폼을 ID="form1" 인 폼을 제거했는데 문제가 사라졌습니다.이것은 당신의 문제가 아니라 비슷한 문제일 수 있습니다.
저의 문제는 서식 태그가 중첩되어 있다는 것이었습니다.안에 있는 거 빼고 운동했어요.
언급URL : https://stackoverflow.com/questions/7476329/asp-net-invalid-postback-or-callback-argument
'programing' 카테고리의 다른 글
빈 JQuery 개체 가져오기 (0) | 2023.08.04 |
---|---|
ViewStateMode와 EnableViewState 비교 (0) | 2023.08.04 |
Oracle에서 ORDER BY 다음에 +0이 표시되는 것은 무엇입니까? (0) | 2023.08.04 |
Spring Boot : 'jpaMappingContext' 이름의 bone을 만드는 중 오류가 발생했습니다. java.lang.Null 포인터예외. (0) | 2023.08.04 |
MySQL EXPLE: "인덱스 사용" vs."인덱스 조건 사용" (0) | 2023.08.04 |