使用Javascript读取Web.config的配置设置 [英] Read Configuration Settings of Web.config using Javascript

查看:107
本文介绍了使用Javascript读取Web.config的配置设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何从web.config中读取值并在静态html中使用这些值.
我需要从web.config中获取价值并将其显示在html中.

hi all,

how to read values from web.config and use those values in static html.
i need to take value from web.config and display it in html.

推荐答案

请参考类似的讨论:

如何在HTML标记 [如何在.html页面中阅读web.config设置? [ ^ ]
Please refer similar discussion:

How to read web.config APP key settings in HTML markup[^]
How to read web.config settings in .html page?[^]


您可以在这里找到一个很好的示例

使用Javascript读取Web.config的配置设置 [ ^ ]

获胜表格中的查询字符串 [
you can find a good sample here

Read Configuration Settings of Web.config using Javascript[^]

query string in win forms[^]

Regards
Sebastian




在您的web.config文件中添加以下示例代码

Hi

Add below example code in your web.config file

</configSections>
<appSettings>
  <!--<add key="ConStr" value=" providerName=System.Data.SqlClient;Data Source=INTEL-PC\SQLEXPRESS;Initial Catalog=School_new;User ID=sa;Password=sa"/>
  <add key="ConnecStr" value="providerName=System.Data.SqlClient;Data Source=INTEL-PC\SQLEXPRESS;Initial Catalog=School_new;User ID=sa;Password=sa"/>-->
  </appSettings>
  <connectionStrings>

>


之后,使用belo头文件和代码获取变量的值.




after that use belo header file and code to get value of variable.

using System.Configuration;  // Header File


DataUtil du = new DataUtil();
    public SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["School"].ConnectionString);

 //paste in code page


这篇关于使用Javascript读取Web.config的配置设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆