I created an HttpHandler which I will use with jquery-Ajax call.
This HttpHandler will access the database and check for something that is currently being recorded by the user .
A user is considered signed using a session with the user_id attribute.
Session["user_id"] = userId;
I tried to fetch this session in HttpHandler but it doesn't seem to work.
So, I was thinking about sending user_id as a parameter .
var user_id = //Retrieved in some way... $.ajax({ url: 'QuestionRate.ashx?id=user_id', success: function (msg, status, xhr) { alert(msg); }, error: function () { alert(msg); } });
But it really seems like a bad idea, anyone who reads the codes can just access the Handler with the identifier that he wants.
So what can I do in this situation? I want the handler to get user_id to access the database, but I want to make sure that this user_id is the actual identifier of the signed user. There is no way to access the session in the handler?
source share