Javascript文件-从web.config在运行时更改源

Javascript文件-从web.config在运行时更改源,javascript,asp.net,Javascript,Asp.net,我的代码中有: <script type="text/javascript" src="path?key=1234567890"> </script> 我在web.config中添加了以下内容: <appSettings> <add key="key" value="1234567890"/> 如何在上述代码中实现它?您可以使用System.Web.Configuration.WebConfigurationManager

我的代码中有:

<script type="text/javascript"
  src="path?key=1234567890">
</script>

我在web.config中添加了以下内容:

<appSettings>
    <add key="key" value="1234567890"/>


如何在上述代码中实现它?

您可以使用
System.Web.Configuration.WebConfigurationManager.AppSettings
集合访问配置设置

<script type="text/javascript"
        src="path?key=<%=WebConfigurationManager.AppSettings["key"]%>">
</script>