Random login popup when using secured map service from ArcGIS Server

660
2
07-10-2019 04:39 AM
MarkSmith
New Contributor III

I’ve just set up some secured cached map services on my ArcGIS Server V10.5.1 and converted my JavaScript API websites to dot net V4.5, upgraded the ESRI JavaScript version to V3.28, and set them up to use the dot net proxy page to handle the username and password process of my secure services.

At first all seemed to be working fine but then I noticed random login boxes appearing asking me to login to the secured map service when I launched the sites.  If I simply refreshed the browser the site loads fine, but I can’t have the public experiencing that.  It doesn’t appear often, but clearly it shouldn’t appear at all.

The random login box popup was appearing when using the Proxy build version 1.1.0, so I tried changing to the latest proxy page version 1.1.2.  Again, at first all seemed fine and the login box appeared to have gone away, but now I have a new random problem.  Now my sites randomly don’t load.  If I open the Developer Tools Console on the browser I see the error “Failed to load resource: the server responded with a status of 500 (Internal Server Error)” as it’s using the proxy to access the secured map.  Again, if I refresh the browser/app the site loads normally and will continue to work fine.

So at the moment I have put the proxy page back to V1.1.0 as I prefer to have a login box error popup than the 500 Internal Server Error message.  I’ve tried it and seen it happen on my home PC, so I know it’s not a problem with my work environment.

What am I doing wrong?  I can’t track it down, it seems like if the site isn’t used for a while the proxy page fails to work, but if I try again then it does – it doesn’t make sense to me, that’s why I’m asking the forum for help.

I found a post from someone else but it goes back a few years, someone suggested increasing the lifespan of short lived tokens – that didn’t help them and I’ve tried that and it hasn’t helped me either.  Has anyone experienced this and found a solution?  Thank you,

Mark.

0 Kudos
2 Replies
GilroyD_silva
New Contributor II

Hi Mark,

Did you find a way to resolve this issue? I am also experiencing this same behavior with the javascript api when accessing secured map services. How did you fix this problem?

Thank you.

Gilroy

0 Kudos
MarkSmith
New Contributor III

Gilroy.

I no longer have this error.  Here's what I have implemented...

Using V1.1.2 of the proxy page I created a dedicated folder on the wwwroot folder to host the proxy files (convert to application .net V4.5 in IIS).  Previously I had a separate proxy folder in each web application with their own proxy files, but by moving the location away from the applications and putting a Proxy folder directly on wwwroot this seems to help.

I then reference the proxy rule in my JavaScript like so:

            urlUtils.addProxyRule({

                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",

                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"

            });

My Proxy config has this:

    <serverUrl url="https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer"

       username="username"
       password="password"
       matchAll="true"

       dynamicToken="true"/>

Hope that helps.

            urlUtils.addProxyRule({
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
            });
            urlUtils.addProxyRule({
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
            });
            urlUtils.addProxyRule({
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
            });
            urlUtils.addProxyRule({
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
            });
            urlUtils.addProxyRule({
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
            });
            urlUtils.addProxyRule({
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
            });
            urlUtils.addProxyRule({
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer",
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
            });
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
                proxyUrl: "https://[myserver]/ProxyFolder/proxy.ashx"
                urlPrefix: "https://[myserver]/ArcGIS/rest/services/
    <serverUrl url="https://[myserver]/ArcGIS/rest/services/[securedMapService]/MapServer"
       username="username"
       password="password"
       matchAll="true"
       dynamicToken="true"/>    <serverUrl url="https://    <serverUrl url="https://    <serverUrl url="https://    <serverUrl url="https://    <serverUrl url="    <serverUrl url="    <serverUrl url="    <serverUrl url="    <serverUrl url="    <server
0 Kudos