Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3489518
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:24:15+00:00 2026-05-18T11:24:15+00:00

I am working on an MVC application using Entity Framework. After creating an EDMX,

  • 0

I am working on an MVC application using Entity Framework.

After creating an EDMX, I noticed the DB connection string is located in TWO places – an app.config file in my Data class library, and a web.config file in my web application.

We want to:

  1. remove these two plain text connection strings

  2. encrypt a single connection string

  3. and use our pre-existing class library to decrypt the connection string when needed

I tried removing one or the other connection string from the config files, and DB access fails. Why are TWO required? And is there any way to do what we want in an MVC – EF project, and how would I tell EF that is what we are doing?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:24:16+00:00Added an answer on May 18, 2026 at 11:24 am

    You can ignore the connection string in your EF project, I think, and just set the connection programmatically from your controller.

    public class SomeController : Controller
    {
        public SomeController()
        {
            /* Substitute whatever method you want to fetch your data source string here */
            /* example assumes plain text from web.config */
            string dataSource = ConfigurationManager
                .ConnectionStrings["ApplicationServices"]
                .ConnectionString;
            this.Entities = new SomeEntities(dataSource);
        }
    
        private SomeEntities Entities { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on asp.net mvc application using the mvc2 framework. Here is the
I'm working on an MVC framework for my company's application and using .htaccess to
I am developing an ASP.Net MVC 3 Web application using Entity Framework 4.1. I
I'm working on a MVC application in which the Model is implemented using an
I have an MVC application that is using MEF for the controllers, all working
Im working on a MVC application, and was just wondering.. Should I be using
I'm working on an intranet MVC web application, using Fluent NHibernate. As everyone knows,
I am working on a Facebook tab application. I am using asp.net MVC 2
I am working on creating an MVC application for an existing Bug tracker of
I'm working on a reporting web application using JasperReport and Spring MVC 3 to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.