get connection string from web.config in csharp

Code Example - get connection string from web.config in csharp

                
                        get connection string
                    
                
 

get connectionstring from web config csharp

                        
                                // Add a using directive at the top of your code file    
using System.Configuration;

// Within the code body set your variable    
string cs = ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString;
                            
                        
 

csharp how to get connection string from app config

                        
                                var connectionString=ConfigurationManager.ConnectionStrings["CharityManagement"].ConnectionString;