<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Define DotNot Proxy in C# in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055629#M72984</link>
    <description>&lt;P&gt;Can I do something like this exmaple?&amp;nbsp; BUT I NEED C#&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/" target="_blank"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 May 2021 13:10:01 GMT</pubDate>
    <dc:creator>jaykapalczynski</dc:creator>
    <dc:date>2021-05-07T13:10:01Z</dc:date>
    <item>
      <title>Define DotNot Proxy in C#</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055423#M72977</link>
      <description>&lt;P&gt;In JavaScript I am adding a proxy rule as such....&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;		
urlUtils.addProxyRule({
	urlPrefix: "https://xxxx.xxxx.xxxx.gov/arcgis/rest/services/Testing/Test/FeatureServer/0",
	proxyUrl:  "https://xxxx.xxxx.xxxx.gov/DotNet/proxy.ashx"
		
});	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I have a .Net app that I need to call a GP Service from C#&amp;nbsp; &amp;nbsp; &amp;nbsp;BUT&amp;nbsp; &amp;nbsp; &amp;nbsp;I want to run it through the proxy so Credentials are not needed....&lt;/P&gt;&lt;P&gt;How would I modify this code to work in C# so I can use it to bypass credentials on a secured GP Service&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;urlUtils.addProxyRule({
	urlPrefix: "https://xxxx.xxxx.xxxx.gov/arcgis/rest/services/Testing/Test/GP_TOOL/",
	proxyUrl:  "https://xxxx.xxxx.xxxx.gov/DotNet/proxy.ashx"
		
});&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 06 May 2021 20:55:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055423#M72977</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2021-05-06T20:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Define DotNot Proxy in C#</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055427#M72978</link>
      <description>&lt;P&gt;In my Web.config I have the URL referenced&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;      &amp;lt;setting name="deletePoints_Dev" serializeAs="String"&amp;gt;
        &amp;lt;value&amp;gt;https://xxxx.xxxx.xxxx.gov/arcgis/rest/services/Testing/GPToolEditor/FeatureServer/0&amp;lt;/value&amp;gt;
      &amp;lt;/setting&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;When I go to use this GP Tool I do this&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        public Boolean DeleteAllPointsFromTable()
        {
            try
            {
                string whereClause = "OBJECTID&amp;gt;-1";
                string gpUrl = deletePoints_Dev;
                if (production) gpUrl = deletePoints_Prod;

                string reqString = gpUrl + "/deleteFeatures?where=" + whereClause;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT I am going to lok down this GP Tool URL like a Feature Service.&amp;nbsp; Where in this workflow would I add the Proxy to bypass this authentication?&lt;/P&gt;&lt;P&gt;WHERE do I put this Proxy Rule?&lt;/P&gt;&lt;P&gt;HOW do I write this in C#&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;		urlUtils.addProxyRule({
			urlPrefix: "https://xxxx.xxxx.xxxx.gov/arcgis/rest/services/Testing/GPToolEditor/FeatureServer/0",
			proxyUrl:  "https://xxxx.xxxx.xxxx.gov/DotNet/proxy.ashx"
		});	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 21:05:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055427#M72978</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2021-05-06T21:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Define DotNot Proxy in C#</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055629#M72984</link>
      <description>&lt;P&gt;Can I do something like this exmaple?&amp;nbsp; BUT I NEED C#&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/" target="_blank"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 13:10:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055629#M72984</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2021-05-07T13:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Define DotNot Proxy in C#</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055668#M72985</link>
      <description>&lt;P&gt;I got it with this....I went another route and got a Token for the service....I will simply apply that to the Service when I call it to satisfy the Credentials needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        // GET TOKEN
        public String GetToken()
        {
            string result = null;
            try
            {
                string gpUrl = "https://xxxx.xxxx.xxxx.gov/arcgis/tokens/generateToken?username=User&amp;amp;password=U$er&amp;amp;expiration=15&amp;amp;f=json";
                string reqString = gpUrl;

                HttpWebRequest req = WebRequest.Create(new Uri(reqString)) as HttpWebRequest;
                req.Method = "POST";
                req.ContentType = "application/json";
                // Encode the parameters as form data:
                byte[] formData = UTF8Encoding.UTF8.GetBytes(reqString);
                //req.contentLength = formData.Length;
                // Send the request:
                using (Stream post = req.GetRequestStream())
                {
                    post.Write(formData, 0, formData.Length);
                }
                // Pick up the response:
                //string result = null;
                using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader =
                    new StreamReader(resp.GetResponseStream());
                    result = reader.ReadToEnd();
                    Console.WriteLine(result.ToString());
                }
                return result;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                result = ex.Message;
                return result;
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 14:45:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/define-dotnot-proxy-in-c/m-p/1055668#M72985</guid>
      <dc:creator>jaykapalczynski</dc:creator>
      <dc:date>2021-05-07T14:45:53Z</dc:date>
    </item>
  </channel>
</rss>

