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 / 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 / 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 / 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 / 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

Difference between asp and asp.net?

4 Answers   Accenture,


How do you secure your configuration files to be accessed remotely by unauthorized users?

0 Answers  


Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?

0 Answers  


what is dumpbin.exe?

1 Answers  


Clearly Explain the ispostback

6 Answers   TCS,






witch is the best insistute in sharpoint course.what abt future of share point course.

2 Answers  


How do you enable tracing? a) Set the Trace property of the Web Form to True b) Set the Trace property of the server object to True c) Set the Session variables Trace to True d) Set the Applications Variable Trace to True.

2 Answers   Syntax Softtech,


How to manage different kinds of sessions in ASP.NET?

0 Answers   Cap Gemini,


What is the latest version of asp.net?

0 Answers  


How can u handle Un Managed Code Exceptions in ASP.Net?

1 Answers   Lara Technology,


what is the difference b/w .net 1.1 and 2.0 ?

2 Answers   Polaris,


What are different transaction options?

2 Answers   Astadia,


Categories