You need to add a reference to System.Configuration
and then use:
System.Configuration.ConfigurationManager.
ConnectionStrings["connectionStringName"].ConnectionString;
More Related Contents:
- Encrypting Web.Config
- How to Convert JSON object to Custom C# object?
- What is the purpose of a question mark after a type (for example: int? myVariable)?
- Fire and forget async method in asp.net mvc
- Object cannot be cast from DBNull to other types
- How can I get a list of users from active directory?
- Has an event handler already been added?
- How to Get IP Address?
- ASP.NET MVC Global Variables
- Currency format for display
- Event Bubbling and MVP: ASP.NET
- Printing to a client printer from a web app
- What is the best way to lock cache in asp.net?
- ASP.NET MVC Razor render without encoding
- Asmx web service how to return JSON and not XML?
- How to omit methods from Swagger documentation on WebAPI using Swashbuckle
- MemoryStream – Cannot access a closed Stream
- Error – is not marked as serializable
- Find all child controls of specific type using Enumerable.OfType() or LINQ
- “new” keyword in property declaration in c#
- How can I get the name of a variable passed into a function?
- How can I secure passwords stored inside web.config?
- How to edit .csproj file
- DateTime.Parse(“2012-09-30T23:00:00.0000000Z”) always converts to DateTimeKind.Local
- How to read appSettings section in the web.config file?
- Built-in helper to parse User.Identity.Name into Domain\Username
- Are static variables thread-safe? C#
- what is [] brackets in .net? [duplicate]
- Can I reuse HttpWebRequest without disconnecting from the server?
- Get a list of weeks for a year – with dates