Ciao Vincenzo,
prova con questa proprietà:
System.Configuration.SettingsPropertyValue.IsHostedInAspnet
per curiosità, decompilando il framework il check che fa è il seguente (tu ovviamente utilizza direttamente la proprietà sopra):
private bool IsHostedInAspnet()
{
return AppDomain.CurrentDomain.GetData(".appDomain") != null;
}
Michael Denny | Microsoft Visual C# MVP
http://blogs.dotnethell.it/Regulator/
http://dennymichael.net
http://mvp.microsoft.com/mvp/Michael%20Denny-5000735
Twitter: @dennymic