How do you retrieve information from web.config ?

Answers were Sorted based on User's Feedback



How do you retrieve information from web.config ?..

Answer / anand

we use as
<appsetting>
<add name="connection" connectionString="Data
Source=...;Initial Catalog=database_name;User
ID=..;Password=.."/>
</appsetting>
and in page
string strConnString =
ConfigurationManager.ConnectionStrings["connection"].ConnectionString.ToString();

Is This Answer Correct ?    4 Yes 1 No

How do you retrieve information from web.config ?..

Answer / sudhir kunnure

In web.congig you can add key and its value.And that key
value u can retrive like

string connectionString =
System.Configuration.ConfigurationSettings.AppSettings
["conStringWeb"].ToString()

Here conStringWeb is my key and i access its value.

Is This Answer Correct ?    3 Yes 0 No

How do you retrieve information from web.config ?..

Answer / ansu_kumar

generaly we store our connection string in web.config file
under tag
<appsetting>
<add key=connection_string
value="data source=......"/>
</appsetting>
and
for accessing the value
in aspx page we writes
string const=
configurationsetting.appsetting.connection_string

Is This Answer Correct ?    3 Yes 0 No

How do you retrieve information from web.config ?..

Answer / sam

using ConfigurationManager, Configuration classes
Example
ConfigurationManager.ConnectionStrings
["str"].ConnectionString;

Is This Answer Correct ?    0 Yes 0 No

How do you retrieve information from web.config ?..

Answer / vikram

By using Configuration Manager we can get information
<appsetting>
<add key=img
value="data source=......"/>
</appsetting>

we can use appsetting
configurationManager.appsetting["img"]

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Describe the master page.

1 Answers  


What would be salary for 8+ years of experience in ASP.NET in different metro city in india?

1 Answers   Prompt Softech,


page life cycle of asp.net.

4 Answers  


What is difference between datalist and gridview?

1 Answers  


How many webforms are possible on a single webpage?

6 Answers  


When web.config is called ?

4 Answers   Keane India Ltd,


will this code works fine? or will it gives error? Object obj=5; int i=6; i=i+obj;

1 Answers   Patni,


When a dropdownlist has been added by some records and it has been binded why it is not executing i'm facing this error pls help me ? if (is!pageposback) { arraylist books = new arraylist; books.add ("gone with the wind"); books.add ("rahulsriramprakash"); books.add ("vishal"); dropdowndisplay.datasource=books; dropdowndisplay.databind(); } The error is : 1) The dropdowndisplay does not exist.

5 Answers   Netsweeper,


What do you mean by authorization?

1 Answers  


Is asp.net 64-bit enabled? How?

1 Answers  


Explain the function of new view engine in asp.net? : asp.net mvc

1 Answers  


Can you explain what inheritance is and give an example of when you might use it?

1 Answers  


Categories