aggiunta gestione eccezioni
This commit is contained in:
Binary file not shown.
@@ -22,32 +22,31 @@ namespace HOME.Controllers
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
ViewBag.Environment = WebConfigurationManager.AppSettings["Environment"];
|
||||
if (logLevel > 5) lg.Info("Environment = " + ViewBag.Environment);
|
||||
using (var ctx = new GPWEntities())
|
||||
{
|
||||
if (logLevel > 5) lg.Info("Entities OK");
|
||||
if (logLevel > 5) lg.Info(string.Format("Inizio connessione DB con Entity Framework, connString:{0}{1}", Environment.NewLine, ctx.Database.Connection.ConnectionString));
|
||||
try
|
||||
{
|
||||
// esegue stored procedure come function, recuperando chiave desiderata...
|
||||
var keyVal = ctx.stp_AKV_getByKey("Environment").ToList<AnagKeyValue>();
|
||||
ViewBag.Environment = keyVal[0].valString;
|
||||
// imposto URL dei vari siti
|
||||
ViewBag.UrlAdmin = ctx.stp_AKV_getByKey("UrlAdmin").ToList<AnagKeyValue>()[0].valString;
|
||||
ViewBag.UrlBCode = ctx.stp_AKV_getByKey("UrlBCode").ToList<AnagKeyValue>()[0].valString;
|
||||
ViewBag.UrlSmart = ctx.stp_AKV_getByKey("UrlSmart").ToList<AnagKeyValue>()[0].valString;
|
||||
ViewBag.UrlWrkLg = ctx.stp_AKV_getByKey("UrlWrkLg").ToList<AnagKeyValue>()[0].valString;
|
||||
if (logLevel > 5) lg.Info("DB: Environment = " + ViewBag.Environment);
|
||||
if (logLevel > 5) lg.Info("DB: UrlAdmin = " + ViewBag.UrlAdmin);
|
||||
}
|
||||
catch
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("Errore in decodifica valori da conf DB:{0}{1}", Environment.NewLine, exc));
|
||||
// in questo caso leggo da web.config
|
||||
ViewBag.Environment = WebConfigurationManager.AppSettings["Environment"];
|
||||
ViewBag.UrlAdmin = WebConfigurationManager.AppSettings["UrlAdmin"]; //"../ADMIN";
|
||||
ViewBag.UrlBCode = WebConfigurationManager.AppSettings["UrlBCode"]; //"../BCODE";
|
||||
ViewBag.UrlSmart = WebConfigurationManager.AppSettings["UrlSmart"]; //"../SMART";
|
||||
ViewBag.UrlWrkLg = WebConfigurationManager.AppSettings["UrlWrkLg"]; //"../WRKLG";
|
||||
if (logLevel > 5) lg.Info("web.config: Environment = " + ViewBag.Environment);
|
||||
if (logLevel > 5) lg.Info("web.config: UrlAdmin = " + ViewBag.UrlAdmin);
|
||||
if (logLevel > 5) lg.Info("Web.config: UrlAdmin = " + ViewBag.UrlAdmin);
|
||||
}
|
||||
}
|
||||
return View();
|
||||
|
||||
@@ -106,10 +106,6 @@
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<elmah>
|
||||
<!--
|
||||
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
|
||||
more information on remote access and securing ELMAH.
|
||||
-->
|
||||
<security allowRemoteAccess="false"/>
|
||||
</elmah>
|
||||
<location path="elmah.axd" inheritInChildApplications="false">
|
||||
@@ -117,15 +113,6 @@
|
||||
<httpHandlers>
|
||||
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
|
||||
</httpHandlers>
|
||||
<!--
|
||||
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
|
||||
more information on using ASP.NET authorization securing ELMAH.
|
||||
|
||||
<authorization>
|
||||
<allow roles="admin" />
|
||||
<deny users="*" />
|
||||
</authorization>
|
||||
-->
|
||||
</system.web>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
|
||||
Reference in New Issue
Block a user