We have developed a Flex app that access the cgi.remote_user.
What we are finding is that when the Flex app accesses this CFC via a
remote object, it is inconsistent in return a value.

The results happen like this:
The user browses to the MXML file for the first time.
Clicks the "Check CGI user", and returns OK, then clicks it again, and
[empty string] is displayed,
and clicks again and the correct result is displayed.
Then the user refreshes the browser, and only [empty string] is
returned every time.

IIS has anonymous access turned off, and it is on the local intranet for them.
I have been told it is running on Windows2003.

Has anyone else come across this before?
If so, how did you fix it?

Cheers,

David


============================================================
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
backgroundColor="#FFFFFF" initialize="initThis()">

    <mx:Panel title="CGI.REMOTE_USER quick check" marginTop="10"
width="300" height="500">
        <mx:VBox>
                <mx:TextArea id="txtLogin" width="250" height="300">            
                
                </mx:TextArea>
                <mx:HBox>
                        <mx:Label text="Atempts:"  />
                        <mx:TextInput id="txtAtempts" text="20"   />
                </mx:HBox>

                <mx:Button label="Check CGI user" click="checkCGI()"/>
        </mx:VBox>
    </mx:Panel>

    <mx:RemoteObject id="srvPermissions"
                source="[My Source Object]"
                endpoint="@ContextRoot()/flashservices/gateway?"
                fault="srvFaultHandle(event)"
                showBusyCursor="true">
                <mx:method name="getCGIUser"            
result="getCGIUserResult(event)"/>              
        </mx:RemoteObject>
        
        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        
                        var aResults:Array      = [];
                                                
                        function initThis(){                            
                        }
                        
                        function checkCGI(){
                                aResults        = new Array();
                                for(var i = 0; i < Number(txtAtempts.text); 
i++){
                                        srvPermissions.getCGIUser();            
                        
                                }
                                
                        }
                        function srvFaultHandle(event){
                                Alert.show("Error Was: " + 
event.fault.faultstring);
                        }
                        
                        function getCGIUserResult(event){
                                var sCGIResult:String   = "";
                                if(event.__result.userName.length != 0){
                                        sCGIResult = event.__result.userName
                                } else {
                                        sCGIResult = "[empty string]";
                                }
                                aResults.push(sCGIResult);
                                
                                if(aResults.length == Number(txtAtempts.text)){
                                        displayResults();
                                }
                        }
                        function displayResults(){
                                var sText:String        = "";
                                
                                for(var i = 0 ; i < aResults.length; i ++){
                                        sText += "Result " + (1+i) + " : " + 
aResults[i] + "\n";
                                }
                                txtLogin.text = sText;
                        }
                
                ]]>
        </mx:Script>

</mx:Application>





=============================================================
<cfcomponent name="Permissions">

        <cffunction name="getCGIUser" access="remote" returntype="struct"
hint="I return the CGI.remote_user value">
                <cfargument name="nameOnly" required="false" default="true"
type="boolean" hint="If this true, only the user name is returned,
with out the domain prefix">
                <cfscript>
                        var stReturnValue       = structNew();
                        
                        stReturnValue["nameOnly"]       = arguments.nameOnly;
                        
                        stReturnValue["userName"]       = cgi.remote_user;
                        
                        // example "SHADO\davidh"
                        if(arguments.nameOnly) stReturnValue["userName"]        
=
listLast(stReturnValue["userName"],"\");
                        
                        return stReturnValue;
                </cfscript>     
        </cffunction>
</cfcomponent>
===============================================================


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to