Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello to all
how can store connection string in web config
Posted

Refer - Store connection string in web.config[^].
Quote:

Connection string in .NET 2.0 config file
XML
<appsettings>
<add key="myConnectionString" value="server=localhost;database=myDb;uid=myUser;password=myPass;" />
</appsettings>

Quote:

Connection string in .NET 3.5 (and above) config file
XML
<connectionstrings>
<add name="myConnectionString" connectionstring="server=localhost;database=myDb;uid=myUser;password=myPass;" />
</connectionstrings>
 
Share this answer
 
v2
XML
<connectionstrings>
<add name="conn_test" connectionstring="Data Source=abc;Initial Catalog=data;Integrated Security=True" />
</connectionstrings>
 
Share this answer
 
v2
Hi Ahmed,

You can store connection string in two different ways,

1) As a normal String-in-web-config,Refer this Link[^]
2) As an Encrypted string (preferable)Refer this Link[^]

I hope this would help you a bit,

Regards,
RK
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900