A
A.M
Hi,
I have following code inside Global.asax.cs. It decrypts the connection
string and assigns it to m_strConnectionString. subsequent instances of
application use the same value.
I am wondering that can this property cause concurrency problems?
Should I Lock and Unlock application object when i am assigning new value to
m_strConnectionString?
Thanks,
Ali
public class Global : System.Web.HttpApplication
{
public static string m_strConnectionString = string.Empty;
...............
.............
public static string ConnectionString
{
get
{
try
{
if (m_strConnectionString == string.Empty )
{
m_strConnectionString = GetEncryptedAppSettings("ConnStr").ToString ();
}
}
catch(Exception e)
{
// FatalError !! Kill the app
}
return m_strConnectionString ;
}
}
I have following code inside Global.asax.cs. It decrypts the connection
string and assigns it to m_strConnectionString. subsequent instances of
application use the same value.
I am wondering that can this property cause concurrency problems?
Should I Lock and Unlock application object when i am assigning new value to
m_strConnectionString?
Thanks,
Ali
public class Global : System.Web.HttpApplication
{
public static string m_strConnectionString = string.Empty;
...............
.............
public static string ConnectionString
{
get
{
try
{
if (m_strConnectionString == string.Empty )
{
m_strConnectionString = GetEncryptedAppSettings("ConnStr").ToString ();
}
}
catch(Exception e)
{
// FatalError !! Kill the app
}
return m_strConnectionString ;
}
}