User Session ID as a Parameter in an Ajax Call

I have created an **HttpHandler** that I will be using with a **jquery-Ajax** call. This **HttpHandler** will access the database and check something related to the **currently singed in user**. The user is considered signed in by using the Session, with an attribute called **user_id**. Session["user_id"] = userId; I tried to retrieve this **Session** in the **HttpHandler** but that doesn't seem to work. So I thought about sending the 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 this really seems like a bad idea, anyone who will read the codes can simply access the Handler with the id that he wants. So what can I do in this situation? I want the Handler to get the user_id for database access, yet I wanna make sure that this user_id is the actual id of the signed in user. There's no way to access the Session in the Handler?

以上就是User Session ID as a Parameter in an Ajax Call的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏