Select to view content in your preferred language

Passing an internet proxy with credentials for Flexviewer

3424
3
05-05-2011 07:01 AM
by Anonymous User
Not applicable
Dear all,

Do any of you have experience on how to get the Flexviewer to pass map requests to the arcigsonline services through an internet proxy that requires login/pwd ?

Basically, I want to avoid the proxy credentials popup in my browser while accessing an internet webservice from the Flexviewer.
I know how to do this in BlazeDS for regular Flex webservice calls, this does not work with the FLEX API mapservice calls 😞

Thanks for any ideas that can point me in the right direction.

Best
Jan
Tags (2)
0 Kudos
3 Replies
by Anonymous User
Not applicable
0 Kudos
by Anonymous User
Not applicable
Have you seen this?

http://help.arcgis.com/en/webapi/flex/help/index.html#/Using_the_proxy_page/017p0000000v000000/


Hi Michael,

Thanks for your input, and yes, I have seen and tried this. The way I understand it, this approach will allow me to connect to secured services on a external domain. What I want to do however, is connect to plain old non secured webservices, but  through a corporate internet proxy that requires authentication.

The setup mentioned on the link above does not allow for this as far as I can figure out.


Jan
0 Kudos
by Anonymous User
Not applicable
After some further digging, I solved this issue using the proxypage .NET approach.

Basically, you need to modify the proxy.ashx handler in the following way (C#.NET) - modifications in bold

*******************************************************************************
public void ProcessRequest(HttpContext context)
        {

            //Added code for passing your local webproxy
            WebProxy proxyObject = new WebProxy("http://999.999.999.999:1234/", true);
            NetworkCredential myCreds = new NetworkCredential("username", "password","domain");
            proxyObject.Credentials = myCreds;

       

            HttpResponse response = context.Response;

            // Get the URL requested by the client (take the entire querystring at once
            //  to handle the case of the URL itself containing querystring parameters)
            string uri = context.Request.Url.Query.Substring(1);

            // Get token, if applicable, and append to the request
            string token = getTokenFromConfigFile(uri);
            if (!String.IsNullOrEmpty(token))
            {
                if (uri.Contains("?"))
                    uri += "&token=" + token;
                else
                    uri += "?token=" + token;
            }

            System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(uri);
//Add proxy to your HttpWebRequest
            req.Proxy = proxyObject;

            req.Method = context.Request.HttpMethod;
            req.ServicePoint.Expect100Continue = false;
            req.Referer = context.Request.Headers["referer"];


..... code continued
*******************************************************************************



Hope this is useful to someone. It works out very well for me.

Jan
0 Kudos