Mehdi
Mehdi

Reputation: 105

How can remove connectionstring from webconfig?

I have a project that has 3 layers.

1)Interface (It is an MVC project with View and Controller)

2)BI (It is a class library project)

3)DAL (It Is A class library that work with Entity Framework DataBase First)

My Problem :

There is a connection string in webconfig of the first project(MVC). But I want remove it. then the other layers should use of DAL Connection Strings.

But when I delete the connection string from that it cant connect and work with DB !!

I remember when I was working with ASP.NET and Linq to sql it was posible.

Please help me.

Upvotes: 2

Views: 2658

Answers (1)

Alexandre Rondeau
Alexandre Rondeau

Reputation: 2687

Once deployed, the only configuration that will be available will be the web.config of your MVC project. Instead of removing the connection string you could just encrypt it.

Personally I'm using a mechanism based on that blog post. I have an administrative api call on my web application to send the information that must be encrypted. - http://weblogs.asp.net/sukumarraju/archive/2009/09/28/encrypt-and-decrypt-connectionstring-section-in-web-config.aspx

Upvotes: 1

Related Questions