How do you retrieve information from web.config ?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Answer / sam
using ConfigurationManager, Configuration classes
Example
ConfigurationManager.ConnectionStrings
["str"].ConnectionString;
Is This Answer Correct ? | 0 Yes | 0 No |
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 |
how to use html code in asp source code?
What is session object? Describe in detail.
Explain the difference between page.registerclientscriptblock and page.registerstartupscript?
Explain the main function of razor in asp.net? : asp.net mvc
Explain Authentication mechanism in dotnet
What is Virtual path in ASP.Net
Write a code for passing ArrayList in Web API?
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?
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?
Can you set which type of comparison you want to perform by the comparevalidator control?
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?