0

I have follow this example to add web.config file to react project.

https://javascript.works-hub.com/learn/how-to-host-a-react-app-on-azure-10042

I have added below code to my web.config.

 <appSettings>
    <add key="SERVICE_BASE_URL"value="https://localhost:44385/"/> 
</appSettings>

I need to read this value from react. Is there a way to do this. please give any suggestions. I tried this way.

import "../web.config";
let SERVICE_BASE_URL = '<%= System.Configuration.ConfigurationManager.AppSettings["SERVICE_BASE_URL"].ToString() %>';
AlexDemo
  • 141
  • 3
  • 14
  • Does this answer your question? [How can I read key value from web.config in javascript file?](https://stackoverflow.com/questions/31091539/how-can-i-read-key-value-from-web-config-in-javascript-file) – Ecstasy Apr 08 '22 at 05:17
  • 1
    @DeepDave-MT I will try with this. Thank you very much! – AlexDemo Apr 08 '22 at 05:21
  • I tried like thi value is not reading let SERVICE_BASE_URL = '<%= System.Configuration.ConfigurationManager.AppSettings["SERVICE_BASE_URL"].ToString() %>'; – AlexDemo Apr 08 '22 at 06:02

0 Answers0