שליחת פרמטרים מJS לCodeBehined בaspx


http://www.developers.org.il/forums/Topic9583.aspx
Print Topic | Close Window

By ++I - 22/02/2010 10:54:30
אני מעונינת לשלוח פרמטרים מצד לקוח (java script) לצד שרת aspx.cs

עשיתי זאת באופן הבא:

קטע קוד

function createDataForSearchWindow(searchType) {

var form = document.getElementById("form1");

form.appendChild(createHidden(searchType));

form.method = "POST";

form.action = "../Entities/Search/SearchWindowManager.aspx";;

form.submit();

}

function createHidden(value) {

var input = document.createElement("input");

input.type = "hidden";

input.value = value;

return input;

}

אין לי מושג מדוע לאחר שאני שולחת את הדף בform.submit מתקבלת שגיאה (הוא מגיע לדף):

Server Error in '/Web' Application.

The state information is invalid for this page and might be corrupted.

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.Web.HttpException: The state information is invalid for this page and might be corrupted.

Source Error:

[No relevant source lines]


Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\web\3b806ce5\8b78e474\App_Web_ra9npeww.0.cs    Line: 0

אשמח לקבל עזרה דחופה!

By Alber - 25/02/2010 01:00:28
זה נראה שאת צריכה להשתמש בdirectives של הדף. אם אני לא טועה זה ValidateRequest.

סתם שאלה: האם זה דף שהמשתמש רואה או רק מעבד נתונים ומחזיר ?
אם הוא רואה את יכול לצרף לURL את המידע בQuerystring.

אם לא את יכולה להשתמש בashx ולא בaspx ולבצע קריאת AJAX.

flow יעזור פה לתשובה.

לאור

By ++I - 07/03/2010 10:39:20
אני לא מעונינת לשלוח פרמטרים בQueryString בגלל בעיות אבטחה!

לא כ"כ הבנתי את שאר הפתרונות שהצעת

בכ"א תודה:thumb_up: