I have an asp.net page where I get the user_id from who's logged in. Now I need to pass this user_id to a flex application that runs in an asp.net page as a .swf. How can I get this user_id in a variable in my flex application. Or what is the best way to get the user_id into flex. Thanks
+1
A:
You make another asp.net page and on this page u get that userid and write on the page. from the flex application hit that asp.net page with the HTTPService and get that response. in that response u get that user id...
var httpservice:HTTPService=new HTTPService();
httpservice.url="http://xyz.com/getuser.aspx;
httpservice.useProxy=false;
httpservice.method="Post";
httpservice.resultFormat="text";
httpservice.addEventListener(FaultEvent.FAULT,GettingException);
httpservice.addEventListener(ResultEvent.RESULT,Result);
httpservice.send();
private function GettingException(e:FaultEvent){
Alert.show(e.fault.message, "Could not load page");
}
private function Result(e:ResultEvent){
var Result:String = e.result.toString();
Alert.show(Result);
}
Atul Yadav
2010-04-22 11:36:00
+1
A:
If you link to the ASP.Net page that holds the swf, you could obfuscate the user_id and pass it in the querystring, or use a guid that maps to the user_id. Flex can read the value from the querystring. See this article.
Or you could paste the user_id value into the flashvars (the ASP.Net page should have access) and read it from there.
userID = Application.application.parameters.user_id;
adamcodes
2010-04-22 13:52:02