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

how to use html code in asp source code?

1 Answers  


What is session object? Describe in detail.

0 Answers  


Explain the difference between page.registerclientscriptblock and page.registerstartupscript?

0 Answers  


Explain the main function of razor in asp.net? : asp.net mvc

0 Answers  


Explain Authentication mechanism in dotnet

0 Answers   BirlaSoft,






What is Virtual path in ASP.Net

2 Answers   Proteans,


Write a code for passing ArrayList in Web API?

0 Answers  


what is SAP fullform

161 Answers   A3Logics, Amazon, DFD, Federal Mogul, Hol Info, IBM, Infosys, Jai Ganesh, Kesri Metal, Lupin, Microsoft, RPG, SAP Labs, SRS Group, TCS, Videocon,


Which object wraps the state or data of a user?

0 Answers  


Which property needs to be set for script manager control to extend the time before throwing time out expection if no response is received from the server?

0 Answers  


Can you set which type of comparison you want to perform by the comparevalidator control?

0 Answers  


I have a method written in WebForm (means .aspx page) & now I want to call this method in WebUserControl (means .ascx page) what should I have to do?

1 Answers   Patni,


Categories