Jake Marmak Jake Marmak - 1 month ago 41
ASP.NET (C#) Question

call web config value in javascript src google map api

I am having a problem with the javascript accessing the webconfig file and here's my javascript side...

<script type='text/javascript' src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=<%=ConfigurationManager.AppSettings["GoogleAPIKey"]%>"></script>


accessing the webconfig but I am receiving an error...

here's the
web.config

<add key="GoogleAPIKey" value="key api"/>


Your helping hand is higly appreciated..

Answer

Here's my Solution to my problem..

<script type='text/javascript' src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=<asp:Literal runat="server" ID="LitGoogle" />" ></script>