I want to read the config file in javascript that is the google key value. here what i am trying to do is passing a javascript variable"keyvalue" that is the keyname in config file but it does not work. i just want it so that the js function automatically picks up the google key according to site URL whether it may be test or dev or qa.abc.com can anyone help me what should i do to read the value form config file.
<script type="text/javascript">
function ReadConfigSettings()
{
var url="test.abc.com"; //window.location.href
var patharray= new Array();
patharray =url.split('.');
var first = patharray[0];
var keyvalue="GoogleKey_"+ first;
var key='<%=ConfigurationManager.AppSettings[keyvalue]%>';
alert(key);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ReadConfigSettings()" />
</div>
</form>
</body>
my config file
<appSettings>
<add key="GoogleKey_dev" value="ABQIAAAAJ4psDZ8kCtN062-LDcwiXhQ85a215fgrIsfghh547457h1ETJRYlwaBGrrytgytg56g7Mx4QFQ"/>
<add key="GoogleKey_qa" value="ABQIAAAACoUjxmFCsPtytryhtyty547547Ryt5gVV28BYSHIaU0BRwPyLrf_gf546Jd_5qxcNZ-_b7WZw"/>
<add key="GoogleKey_test" value="AIzaSyvbghgfyh54654650x2SlGb33KrTtIBc"/>