Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Coonection Strings in web.config

Coonection Strings in web.config

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anujose
    wrote on last edited by
    #1

    Hi, in asp.net why we are writing connection strings in web.config?.can't we store connection strings in class or in any dll. With regards, anu

    E N A 3 Replies Last reply
    0
    • A anujose

      Hi, in asp.net why we are writing connection strings in web.config?.can't we store connection strings in class or in any dll. With regards, anu

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      It doesn't make as much sense in ASP.NET because it is compiled on demand. However, the reasoning is that configuration settings should not be compiled into an application. Also, SOX compliance and good corporate governance means a developer should not have access to production passwords, thus a network admin needs to be able to make the adjustments.

      Need a C# Consultant? I'm available.
      Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

      1 Reply Last reply
      0
      • A anujose

        Hi, in asp.net why we are writing connection strings in web.config?.can't we store connection strings in class or in any dll. With regards, anu

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        It's your choice of keeping connection string. It can be kept anywhere. But keeping it in a configuration file like web.config, allows to edit the value without recompiling your application.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

        S 1 Reply Last reply
        0
        • N N a v a n e e t h

          It's your choice of keeping connection string. It can be kept anywhere. But keeping it in a configuration file like web.config, allows to edit the value without recompiling your application.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          S Offline
          S Offline
          Shimmy Weitzhandler
          wrote on last edited by
          #4

          yes you configure a connection string programmatically in every class on your application. of course, I'm sure you wated the conection strings to be saved in the settings, ypu could do it by adding the necessarily references. as well you can use your dataset designer to do it.

          Shimi

          1 Reply Last reply
          0
          • A anujose

            Hi, in asp.net why we are writing connection strings in web.config?.can't we store connection strings in class or in any dll. With regards, anu

            A Offline
            A Offline
            Arun Jacob
            wrote on last edited by
            #5

            Also we can protect the connectionstring specified in connectionstrings section of web.config.

            Arun J

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups