Select to view content in your preferred language

Problem Adding a proxy file to an asp.net application using that will use portal server

2958
0
09-21-2015 02:04 PM
HectorAsencio
New Contributor II

I have a service located in a portal server. I registered an application and obtained the client id and client secret.I configure the proxy, suing the proxy for .net found here resource-proxy/DotNet at master · Esri/resource-proxy · GitHub​ , however when I run the program and it enters the proxy files, it returns an 403 error unauthorized. I will like to figure out if I make the registration correctly or if there is something wrong with the way I am accessing the proxy the proxy.ashx file that came with the proxy link mention earlier is in its original state. . Here is my proxy.config modified.for my purpose. The code in bold is the one giving me the error when I tried to access it. the code in green are different approaches I've work with to see if they work. I will like to help with this problem I've been stuck for and entire day with these and on the internet I haven't found something concrete that helps me solve this problem.

thank you very much in advance, any help appreciated.

<?xml version="1.0" encoding="utf-8" ?>

<!-- Proxy config is used to set the ArcGIS Server services that the proxy will forward to.

       

        mustMatch: true to only proxy to sites listed, false to proxy to any site -->

<ProxyConfig allowedReferers="*" mustMatch="true">

    <serverUrls>

        <!-- serverUrl options:

            url = location of the ArcGIS Server, either specific URL or stem

            matchAll = true to forward any request beginning with the url

            token = (optional) token to include for secured service

            dynamicToken = if true, gets token dynamically with username and

              password stored in web.config file's appSettings section.

    -->

        <serverUrl url="http://server.arcgisonline.com/"

                  matchAll="true"></serverUrl>

        <serverUrl url="https://services.arcgisonline.com/"

                  matchAll="true"></serverUrl>

        <serverUrl url="http://services.arcgisonline.com/"

                  matchAll="true"></serverUrl>

        <serverUrl url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"

                   matchAll="true"></serverUrl>

        <serverUrl url="http://static.arcgis.com/"

                   matchAll="true"></serverUrl>       

     

            <serverUrl url="http://gis.hacienda.gobierno.pr/ArcGIS/rest/services/LocalizadorCompuesto/GeocodeServer/findAddressC..."

              oauth2Endpoint = "http://gis.hacienda.gobierno.pr/portal/sharing/oauth2/token"

              cliendId="v******************"

              clientSecret="27***********************"

              matchAll="true"

        />

  <serverUrl url="https://gis.hacienda.gobierno.pr/ArcGIS/rest/services/LocalizadorCompuesto/GeocodeServer/findAddress..."

              oauth2Endpoint = "https://gis.hacienda.gobierno.pr/portal/sharing/oauth2/token"

              cliendId="v******************"

              clientSecret="27***********************"

              matchAll="true"

        />

        <serverUrl url="http://gis.hacienda.gobierno.pr/ArcGIS/rest/info"

              matchAll="true"

        />

      

       <serverUrl url="https://gis.hacienda.gobierno.pr/ArcGIS/rest/info"

              matchAll="true"

        />

        <serverUrl url ="http://gis.hacienda.gobierno.pr/ArcGIS/rest/services/Movil/ComerciosHacienda_QA/FeatureServer/0"

          matchAll="true"></serverUrl>

     

  

  <!--**************************************************************->

   <!-- commented code used however commented because it didn't work-->

  

        <!--<serverUrl url="http://gis.hacienda.gobierno.pr/ArcGIS/"

                 matchAll="true"

  clientId="5s**********"

  clientSecret="0a******************8">

        </serverUrl>-->

        <!--<serverUrl url="https://gis.hacienda.gobierno.pr/portal/sharing/rest/generateToken"

                 matchAll="true"

                 username="************"

                 password="*****************">

        </serverUrl>-->

     

<!--<serverUrl url="http://gis.hacienda.gobierno.pr/ArcGIS/rest/services/LocalizadorCompuesto/GeocodeServer/"

             oauth2Endpoint = "https://gis.hacienda.gobierno.pr/portal/sharing/oauth2"

             clientId="5s**********"

             clientSecret="0a******************8"

             matchAll="true"

      ></serverUrl>-->

           <!--<serverUrl url="https://gis.hacienda.gobierno.pr/portal/sharing/rest/generateToken"

                 matchAll="true"

                 username="************"

                 password="*****************">

        </serverUrl>-->

         <!--<serverUrl url="https://gis.hacienda.gobierno.pr/portal/sharing/rest/generateToken"

                 matchAll="true"

                 username="************"

                 password="*****************">

        </serverUrl>-->

      <!--SECURE FEATURE SERVICE EXAMPLE-->

      <!--<serverUrl url ="http://youredomain.com/arcgis/rest/services/Movil/Comercios_QA/FeatureServer/0"

                matchAll="true"

                dynamicToken="true"

                host="youredomain.com"

                userName="YoureUserName"

                password="YourePassword">

      </serverUrl>-->

  

         <!--<serverUrl url="http://gis.hacienda.gobierno.pr/portal"

      oauth2Endpoint = "https://gis.hacienda.gobierno.pr/portal/sharing/oauth2"

      clientId="5*********************"

      clientSecret="0a8***********************"

                  matchAll="true"

        />-->

            <!--HACIENDA TEST SERVICES   oauth2_endpoint="https://gis.hacienda.gobierno.pr/portal/sharing/rest/oauth2/"-->

      <!--<serverUrl url="http://gis.hacienda.gobierno.pr/"

             matchAll="true"

             username="5s***************"

             password="0a8***************************">

      </serverUrl>-->

    </serverUrls>

</ProxyConfig>

0 Kudos
0 Replies