Possible Duplicate:
Get query string values in JavaScript
I have a calendar web page. When user opens event, it opens the page with url like: "http://localhost/Event.aspx?eventid=4" Then I use jQuery to call a page method to show some extra data. Data parameters, that I am sending through $.ajax function, also include "eventID" (to show data for correct event). If user would manually (let's say through firebug console) execute jQuery call to page method with faked "eventID", he would get false data. I would like to prevent that,... in a way to not send eventid with jQuery data parameters, but somehow get eventid on server-side codebehind. The thing is, that I can't use sessions (because user can open more than one event and each one would have it's own eventID) and I also can't use cookies, cause they can be hacked also. So I was trying to get correct eventid directly inside page method, using
HttpContext.Current.Request.QueryString
but with no luck. On Page_Load I get my eventid with:
EventID = Page.Request.QueryString("eventid")
but I can't find a way to get this eventid value into my page method.
So, I am asking for an advice of how to get a page method parameter value from url or public variable defined on Page_Load.
thanks.
EDIT: Currently I am using POST to send parameters like:
var myEventId = $("#hiddenField").val();
$.ajax({
url: "Event.aspx/getEventData",
type: "POST",
data: "{'eventid':myEventId}"
...
});
But I would like to avoid sending eventid parameter with POST, to prevent hacking.