I have an application page which connects to a sql database based on settings on a list hosted in central admin.
For some reason, I cant debug the web.GetSafeListByName, I attach the debugger, put a breakpoint, the breakpoint is red which means the symbols are loaded, but the debugget doesnt get there.
Then It shows Access Denied on the page, and in the Exception it shows
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
public static String GetDMSApplicationSetting(String key)
{
String value = String.Empty;
try
{
String caUrl = GetCentralAdminUrl();
if (!String.IsNullOrEmpty(caUrl))
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(caUrl))
{
using (SPWeb web = site.OpenWeb())
{
SPList DMSConfigList = web.GetSafeListByName(Constants.Lists.DmsApplicationSettingsUrl);
if (DMSConfigList!=null)
{