buzibuzi
01-03-2009, 05:36 PM
Hi,
im building a AS3 application that authenticates users to get access to wireless networks (like you have in airports and hotels)
when a user connects to the specific wireless network, he gets a landing page which authenticates him against a Radius server.
this page hosts the flash file. usually it is done with a http POST and it works fine.
for flash i have a form which performs the authentication by sending a user and password to the radius server.by the server response i can tell if it succeeded or not.
here is the issue:
the AS3.0 flash uses URLRequestMethod.POST to send the form and process the response.
if i run the flash locally on my pc when connected to the wireless network it works fine.and i get a response from the server.
if i run the flash file as an executable file (.exe) from a remote desktop on a different domain - it works fine.
but when i have the flash movie embedded in an html file hosted on a web server in a different domain i get an error message.
(httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0])
i get this message regardless if the cre
here are the things i checked:
there is no firewall blocking the communication.
there is a crossdomain.xml file in the root of the webserver permitting all domain.
the flash parameters are defined having "'allowScriptAccess','always'"
and when exporting the flash i use - local playback security - access networks only.
i tried hosting the file on a different webserver - same issue.
the error im getting is :
here is the AS3 code:
var _request:URLRequest = new URLRequest("https://ssl.xxx.com/login.cgi");
_request.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
var currentpartner:String;
this.currentpartner = "xxx";
//method to submit form
root.browser_mc.browser.sendForm.addEventListener( MouseEvent.CLICK, sendActions(currentpartner));
root.browser_mc.browser.clearForm.addEventListener (MouseEvent.CLICK, clearFields);
//clear_btn.addEventListener(MouseEvent.CLICK, clearFields);
//function called from method, contains validation logic and var data to be sent to form
function sendActions(username:String):Function{
return function (event:Event){
//conditional logic to validate form fields
if(!root.browser_mc.browser.form_name.length) {
root.browser_mc.browser.status_text.text = "please fill in your name";
} else {
root.browser_mc.browser.status_text.text = "";
var sendresponse = "connecting...";
var variables:URLVariables = new URLVariables();
//Set up variables to send
variables.password = root.browser_mc.browser.form_password.text;
root.browser_mc.browser.status_text.text = sendresponse;
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener( Event.COMPLETE, sendComplete );
loader.addEventListener( IOErrorEvent.IO_ERROR, sendIOError );
loader.addEventListener(HTTPStatusEvent.HTTP_STATU S, httpStatusHandler);
//loader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.addEventListener(Event.OPEN, openHandler);
_request.data = variables;
loader.load( _request );
}
}
}
function sendComplete( e:Event ):void {
var mycode;
root.browser_mc.browser.status_text.text = "connection established... verifying credentials";
//e.target.data.wordWrap = false;
this.myCode = e.target.data.replace(/\r/g,"");
var re:RegExp = /<body>(.*)<\/body>/i;
var result1:Object = re.exec(e.target.data);
var re2:RegExp = /<title>(.*)<\/title>/i;
var result2:Object = re2.exec(e.target.data);
if(result1){
//trace(result1[1]);
if(result1[1] == " "){
root.browser_mc.browser.status_text.text = "you are now connected";
}
}
if(result2){
root.browser_mc.browser.status_text.text = result2[1]
// trace(result2[1]);
}
}
function httpStatusHandler(event:HTTPStatusEvent):void {
//trace("httpStatusHandler: " + event);
root.browser_mc.browser.status_text.text = "status: " + event.status + "httpStatusHandler: " + event;
// trace("status: " + event.status);
}
function openHandler(event:Event):void {
// trace("openHandler: " + event);
}
function sendIOError( e:IOErrorEvent ):void {
root.browser_mc.browser.status_text.text = "There is a problem connecting to the server, please check that you are not connected";
}
and here is the html code that embeds the flash:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-8" />
<title>main_wide</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#9d102d">
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '1024',
'height', '800',
'src', 'main_wide',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'noborder',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'main_wide',
'bgcolor', '#9d102d',
'name', 'main_wide',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', 'main_wide',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="1024" height="800" id="main_wide" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="main_wide.swf" /><param name="quality" value="high" /><param name="scale" value="noborder" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#9d102d" /> <embed src="main_wide.swf" quality="high" scale="noborder" wmode="transparent" bgcolor="#9d102d" width="1024" height="800" name="main_wide" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
</html>
does anyone have a clue what this might be related to ? could it be related to the fact that the radius is using a SSL connection ?
im building a AS3 application that authenticates users to get access to wireless networks (like you have in airports and hotels)
when a user connects to the specific wireless network, he gets a landing page which authenticates him against a Radius server.
this page hosts the flash file. usually it is done with a http POST and it works fine.
for flash i have a form which performs the authentication by sending a user and password to the radius server.by the server response i can tell if it succeeded or not.
here is the issue:
the AS3.0 flash uses URLRequestMethod.POST to send the form and process the response.
if i run the flash locally on my pc when connected to the wireless network it works fine.and i get a response from the server.
if i run the flash file as an executable file (.exe) from a remote desktop on a different domain - it works fine.
but when i have the flash movie embedded in an html file hosted on a web server in a different domain i get an error message.
(httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0])
i get this message regardless if the cre
here are the things i checked:
there is no firewall blocking the communication.
there is a crossdomain.xml file in the root of the webserver permitting all domain.
the flash parameters are defined having "'allowScriptAccess','always'"
and when exporting the flash i use - local playback security - access networks only.
i tried hosting the file on a different webserver - same issue.
the error im getting is :
here is the AS3 code:
var _request:URLRequest = new URLRequest("https://ssl.xxx.com/login.cgi");
_request.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
var currentpartner:String;
this.currentpartner = "xxx";
//method to submit form
root.browser_mc.browser.sendForm.addEventListener( MouseEvent.CLICK, sendActions(currentpartner));
root.browser_mc.browser.clearForm.addEventListener (MouseEvent.CLICK, clearFields);
//clear_btn.addEventListener(MouseEvent.CLICK, clearFields);
//function called from method, contains validation logic and var data to be sent to form
function sendActions(username:String):Function{
return function (event:Event){
//conditional logic to validate form fields
if(!root.browser_mc.browser.form_name.length) {
root.browser_mc.browser.status_text.text = "please fill in your name";
} else {
root.browser_mc.browser.status_text.text = "";
var sendresponse = "connecting...";
var variables:URLVariables = new URLVariables();
//Set up variables to send
variables.password = root.browser_mc.browser.form_password.text;
root.browser_mc.browser.status_text.text = sendresponse;
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener( Event.COMPLETE, sendComplete );
loader.addEventListener( IOErrorEvent.IO_ERROR, sendIOError );
loader.addEventListener(HTTPStatusEvent.HTTP_STATU S, httpStatusHandler);
//loader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.addEventListener(Event.OPEN, openHandler);
_request.data = variables;
loader.load( _request );
}
}
}
function sendComplete( e:Event ):void {
var mycode;
root.browser_mc.browser.status_text.text = "connection established... verifying credentials";
//e.target.data.wordWrap = false;
this.myCode = e.target.data.replace(/\r/g,"");
var re:RegExp = /<body>(.*)<\/body>/i;
var result1:Object = re.exec(e.target.data);
var re2:RegExp = /<title>(.*)<\/title>/i;
var result2:Object = re2.exec(e.target.data);
if(result1){
//trace(result1[1]);
if(result1[1] == " "){
root.browser_mc.browser.status_text.text = "you are now connected";
}
}
if(result2){
root.browser_mc.browser.status_text.text = result2[1]
// trace(result2[1]);
}
}
function httpStatusHandler(event:HTTPStatusEvent):void {
//trace("httpStatusHandler: " + event);
root.browser_mc.browser.status_text.text = "status: " + event.status + "httpStatusHandler: " + event;
// trace("status: " + event.status);
}
function openHandler(event:Event):void {
// trace("openHandler: " + event);
}
function sendIOError( e:IOErrorEvent ):void {
root.browser_mc.browser.status_text.text = "There is a problem connecting to the server, please check that you are not connected";
}
and here is the html code that embeds the flash:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-8" />
<title>main_wide</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body bgcolor="#9d102d">
<script language="javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '1024',
'height', '800',
'src', 'main_wide',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'noborder',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'main_wide',
'bgcolor', '#9d102d',
'name', 'main_wide',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', 'main_wide',
'salign', ''
); //end AC code
}
</script>
<noscript>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="1024" height="800" id="main_wide" align="middle">
<param name="allowScriptAccess" value="always" />
<param name="allowFullScreen" value="false" />
<param name="movie" value="main_wide.swf" /><param name="quality" value="high" /><param name="scale" value="noborder" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#9d102d" /> <embed src="main_wide.swf" quality="high" scale="noborder" wmode="transparent" bgcolor="#9d102d" width="1024" height="800" name="main_wide" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</noscript>
</body>
</html>
does anyone have a clue what this might be related to ? could it be related to the fact that the radius is using a SSL connection ?