how to encrypt a connection string in web.config file?

Answer Posted / anand gopal makwa munger

write the code on web.config file Like below

<configuration>
<appSettings/>
<connectionStrings>
<add name="Connection" providerName="System.Data.SqlClient" connectionString="server=abc\Sqlexpress;IntegratedSecurity=SSPI;DataBase=XYZ"/>
</connectionStrings>
</configuration>

and write the code Behind page(ie .cs File)

ConnectionStringSettings con = ConfigurationManager.ConnectionStrings["Connection"];
SqlConnection conn = new SqlConnection(con.ConnectionString);

Is This Answer Correct ?    0 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between datalist and gridview?

587


ASP.NET 2.0's new membership API used for creating and managing user account is exposed through which 2 clause?

1472


Explain the difference between overriding and overloading?

549


Describe how ASP.NET maintains process isolation for each Web application?

577


What is routing in MVC?

601






What is the difference between response.redirect and server.transfer?

540


What is the use of session in web application?

489


What is the file extension of web service?

558


Explain the flow of processing of the request? : asp.net mvc

537


9. Why should we hire you over the others waiting to be interviewed?

2141


Are cookies client side or server side?

500


What is the significance of ASP.NET routing?

638


What is meant by asp.net?

544


What are the modes of updation in an updatepanel?

555


How to comment out asp.net tags?

636