ASP.NET Global Class | Global Variables -


i have global.cs within app_code.

here variable have set:

static string _constring;  //connection string public static string constring {     { return _constring; }     set { _constring = configurationmanager.connectionstrings["breakersconnectionstring"].tostring(); } } 

when use global.constring in web form code behind comes null.

what doing wrong?

first,

i believe should use

configurationmanager.connectionstrings["breakersconnectionstring"].connectionstring 

http://msdn.microsoft.com/en-us/library/system.configuration.connectionstringsettings.aspx

second, did check web.config make sure connection string there?

also, need return in acessor.

get { return configurationmanager.connectionstrings["breakersconnectionstring"].connectionstring } 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

sql server - python to mssql encoding problem -

windows - Python Service Installation - "Could not find PythonClass entry" -