<?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: Dealing with CORS When Using PictureMarkerSymbol in .NET and the Esri JavaScript API Questions</title>
    <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/dealing-with-cors-when-using-picturemarkersymbol/m-p/811774#M47</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works out right after I locate my image in url:"localhost:{Port}/{Project name}/cocacola.png", so if anyone is looking for a non-CORS/proxy-related solution, try my approach. Thanks for your reply tho.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Sep 2019 00:45:49 GMT</pubDate>
    <dc:creator>JerryChen</dc:creator>
    <dc:date>2019-09-05T00:45:49Z</dc:date>
    <item>
      <title>Dealing with CORS When Using PictureMarkerSymbol</title>
      <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/dealing-with-cors-when-using-picturemarkersymbol/m-p/811772#M45</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to use an existing png image as customised PictureMarkerSymbol. The image is in the same folder as my .NET project(.sln) is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try the url : &lt;SPAN style="color: #c41a16; background-color: #f8f8f8;"&gt;"https://static.arcgis.com/images/Symbols/Shapes/BlackStarLargeB.png"&lt;/SPAN&gt;, it works like it should. But when I try my locally hosted image, the symbol turns into black dots instead of the image I want to show.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The browser returns the error :&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Access to image at 'http://{My IP}:{Port}/cocacola.png' from origin 'http://localhost:49387' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The document offers three approaches to avoid CORS issues :&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/458412_擷取5.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To me, enabling CORS and proxy is too complicated and time-consuming, so I went for hosting the image on the same domain. My issue is, am I doing it right putting the image in the same folder as the project file? If i am, why does it still seem like a CORS issue?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2019 02:05:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/dealing-with-cors-when-using-picturemarkersymbol/m-p/811772#M45</guid>
      <dc:creator>JerryChen</dc:creator>
      <dc:date>2019-09-03T02:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with CORS When Using PictureMarkerSymbol</title>
      <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/dealing-with-cors-when-using-picturemarkersymbol/m-p/811773#M46</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jerry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your image, in your local IIS web.confg, under configuration element.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&amp;lt;system.webServer&amp;gt;
&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;httpProtocol&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;customHeaders&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;add&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;name&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;Access-Control-Allow-Headers&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;value&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;Origin, X-Requested-With, Content-Type, Accept&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;add&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;name&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;Access-Control-Allow-Methods&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;value&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;*&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;&lt;/SPAN&gt;add&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;name&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;Access-Control-Allow-Origin&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="attr-name token"&gt;value&lt;/SPAN&gt;&lt;SPAN class="attr-value token"&gt;&lt;SPAN class="punctuation token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;*&lt;SPAN class="punctuation token"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;/&lt;/SPAN&gt;customHeaders&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token tag"&gt;&lt;SPAN class="token tag"&gt;&lt;SPAN class="punctuation token"&gt;&amp;lt;/&lt;/SPAN&gt;httpProtocol&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&amp;lt;/system.webServer&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://enable-cors.org/server_iis7.html" title="https://enable-cors.org/server_iis7.html" rel="nofollow noopener noreferrer" target="_blank"&gt;https://enable-cors.org/server_iis7.html&lt;/A&gt;&amp;nbsp; (sample)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding to CORS,&amp;nbsp; that article might help you.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://medium.com/@baphemot/understanding-cors-18ad6b478e2b" title="https://medium.com/@baphemot/understanding-cors-18ad6b478e2b" rel="nofollow noopener noreferrer" target="_blank"&gt;https://medium.com/@baphemot/understanding-cors-18ad6b478e2b&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just think about it, it is required first enable/allow at the server side first before you are trying to configure at the client side.&lt;/P&gt;&lt;P&gt;In your scenario, asp.net shall be server side, arcgis shall&amp;nbsp; be client side.&lt;/P&gt;&lt;P&gt;So try and configure in asp.net/ local IIS side first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the list of few way.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/enabling-cross-origin-requests-in-web-api" title="https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/enabling-cross-origin-requests-in-web-api" rel="nofollow noopener noreferrer" target="_blank"&gt;Enabling Cross-Origin Requests in ASP.NET Web API 2 | Microsoft Docs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://docs.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-2.2" title="https://docs.microsoft.com/en-us/aspnet/core/security/cors?view=aspnetcore-2.2" rel="nofollow noopener noreferrer" target="_blank"&gt;Enable Cross-Origin Requests (CORS) in ASP.NET Core | Microsoft Docs&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to troubleshoot&lt;/P&gt;&lt;P&gt;For verification, the best item I will use is Chrome developer network tab or fiddler. (I prefer fiddler for this case).&lt;/P&gt;&lt;P&gt;Check that the response from the server already supply with below headers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Normally * value is to allowed everything.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Access-Control-Allow-Origin, Access-Control-Allow-Headers, Access-Control-Allow-Methods&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But some of the js library at client side does not like *, so you need define complete set as much as you can.&lt;/P&gt;&lt;P&gt;Hope these may help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:32:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/dealing-with-cors-when-using-picturemarkersymbol/m-p/811773#M46</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T09:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dealing with CORS When Using PictureMarkerSymbol</title>
      <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/dealing-with-cors-when-using-picturemarkersymbol/m-p/811774#M47</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works out right after I locate my image in url:"localhost:{Port}/{Project name}/cocacola.png", so if anyone is looking for a non-CORS/proxy-related solution, try my approach. Thanks for your reply tho.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Sep 2019 00:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/dealing-with-cors-when-using-picturemarkersymbol/m-p/811774#M47</guid>
      <dc:creator>JerryChen</dc:creator>
      <dc:date>2019-09-05T00:45:49Z</dc:date>
    </item>
  </channel>
</rss>

