Hi Asad,
Ok, I did it a different way with another config setting instead of the compiler flag. To use the #if NET35 would have required creating a bunch of new projects because then we would need different versions of mojoPortal.Web.Framework project and a few others fo .NET 4.0 to be different.
If you revert your changes and get the latest code from the repository it should be fixed now like this:
// 2010-07-18 this part throws an error under .NET 4, Asad says it is still needed for 3.5
if (ConfigHelper.GetBoolProperty("UseNet35PersianHelper", false)) //this setting is true in the We.config for 3.5 .NET but not 4.0
{
typeof(DateTimeFormatInfo).GetField("calendar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).SetValue(info, cal);
object obj = typeof(DateTimeFormatInfo).GetField("m_cultureTableRecord",
BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).GetValue(info);
obj.GetType().GetMethod("UseCurrentCalendar",
BindingFlags.NonPublic | BindingFlags.Instance).Invoke(obj, new object[] { cal.GetType().GetProperty("ID", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(cal, null) });
typeof(CultureInfo).GetField("calendar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).SetValue(persianCulture, cal);
typeof(CultureInfo).GetField("calendar", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).SetValue(persianCulture, cal);
}
I have set UseNet35PersianHelper as true in the Web.net35.config, and I set UseCustomHandlingForPersianCulture as true in both versions of Web.config
Thanks,
Joe