Can't see any session values when using Uploadify in ASP.NET

不打扰是莪最后的温柔 提交于 2019-12-25 04:04:12

问题


I'm using Uploadify to upload files in my site and in order to make upload more secure I create 'token' (random number) in server side once the page loaded and put it in Session and in JS variable so that when I start upload files I send the same token back to server.
The problem is when sending it back I traced the code and the session values all lost, looks like its another session.
How is that happening and how can I fix it?
Here's a pseudo code in ASP.NET:

Server side

var token = getRandomNumber();
Session["myToken"] = token;
Response.write("<script> var tokenInJS = "+token+"</script>");

Thanx


回答1:


Have you read this post in Uploadify's manual about a bug in flash that prevents it from posting a session variable.




回答2:


var token = getRandomNumber();
//put the token into session.
Session["myToken"] = token;

//use session variable
Response.write("<script> var tokenInJS = "+Session["myToken"]+"</script>");


来源:https://stackoverflow.com/questions/10469227/cant-see-any-session-values-when-using-uploadify-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!