Sofie_vo
Sofie_vo

Reputation: 21

passing parameter from asp.net page to flex application

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

Upvotes: 2

Views: 1020

Answers (2)

adamcodes
adamcodes

Reputation: 1606

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;

Upvotes: 1

Atul Yadav
Atul Yadav

Reputation: 496

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);

}

Upvotes: 1

Related Questions