How to use a variable in web.config

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have a Asp.Net project, it use JScript to program the client's script
I declare a variable in web.config like:
<add key="CompanyName" value="Big Salse company" />

How can I use the CompanyName in my jscript?
 
You will need to write out the jscript from your code behind page.
You could use a client side call to a webservice from jscript but if all you
need is to pick up a name then write out your variable from the code behind
when the page loads.
 
Hi,

In your javascript client block u can add this:
var
compname='<%=System.Configuration.ConfigurationSettings.AppSettings["CompanyName"] %>'
//alert(compname);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top