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 |
What is __ requestverificationtoken?
How do you store a value in viewstate and retrieve them?
What is active web page?
Which method do you use to kill explicitly a users session?
What is new asp.net core?
About web methods and its various attributes ?
Mention the namespace that is used to include .net data provider for sql server in .net code?
What is Web Gardening? How would using it affect a design ?
How can we access static variable?
What is the concepts of globalization and localization in .net?
What is the need of client side and server side validation ?
What is the difference between sealed vs static class?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)