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 |
Difference between application events and session events
How would you implement inheritance using c#?
Is it possible to create web application with both webforms and mvc?
Whta are the Various steps taken to optimize a web based application (caching, stored procedure etc.) ?
What is the differences between a primary key and a unique key in sql server?
Explain the difference between asp and asp.net?
What is the exact purpose of http handlers?
what is use of doctype tag in asp.net
What is server side session management?
I need to download file from web server, without using save as dialogue box. Can anyone help, thanks In advance.
How Web Service help? What is the difference between Remoting & Web Servcies?
What is DataGrid wheater its a Server Control or something else ?
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)