C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Get Connection String from Web.config in ASP.NET
WhatsApp
Ramesh Joshi
Apr 22
2016
34.9
k
0
1
<connectionStrings>
<add name=
"myDbConnection"
providerName=
"System.Data.SqlClient"
connectionString=
"Data Source=myServer;Integrated Security=true;Initial Catalog=myDatabase"
/>
</connectionStrings>
protected
void
Page_Load(
object
sender, EventArgs e)
{
string
con = System.Configuration.ConfigurationManager.ConnectionStrings[
"myDbConnection"
].ConnectionString;
}
Get ConnectionString
Web.config
Asp.net
Up Next
Get Connection String from Web.config in ASP.NET