 |
|
 |
Dear Reza
Thank you
|
|
|
|
 |
|
 |
Thank's. I hope that work Correctly
|
|
|
|
 |
|
 |
Hi,
I'm using your wonderful approach for setting persiancalendar in cultureinfo in codeproject
but when i upload my application to web i got a securityexception (Code access security because of reflection in secured trusted environment) how can i solve this problem because this is vital for my application.
and another problem is when i switched my app to .net 4 i got exception
because system.globalization.culturetablerecord type is no longer exists in .net 4.
I would be thankful if you could guide me to solve these problems.
Regards
Arash
|
|
|
|
 |
|
 |
Decrease your trusted level. Set to Full in your web.config by
<trust level="Full"/>
modified on Friday, June 25, 2010 4:23 PM
|
|
|
|
 |
|
 |
I have changed trust level to Medium but i got exception because reflection needs full trust. how we can use reflection in medium trust?
or maybe there is another solution?
Thank you very much for your reply
Arash
|
|
|
|
 |
|
 |
I apologize, you're right. set it to full trusted. I hope it will work; otherwise please, get me stack trace to identify problem.
Unfortunately I didn't try to find a way same as this solution for .net 4(until now).
|
|
|
|
 |
|
 |
Hi, my hosting provider does not support Full trust mode
and in Medium trust mode i got this exception:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request failed.]
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +284
System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +69
System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +150
System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +30
System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +40
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +123
System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +54
what about the second approach
you mentioned that wen should contact you for error that we got?
could you guide me please for solving this problem?
Thanks
Arash
|
|
|
|
 |
|
 |
Although the topic is really useful and interesting, it seems that this article needs more clarification.
|
|
|
|
 |
|
 |
"m_cultureTableRecord" field does not exist in .NET Framework 4.0
do you have any solution?
|
|
|
|
 |
|
|
 |
|
 |
salam hamvatan omidvaram halet khoob bashe man ye soal darm raje be componente telerik.
ma az in codi ke shoma dadid dar telerik component use kardam va calendare un shamsi shod hala ye moshkeli tooye datetimepicker , schedule dare ke erroresh ro baratoon mizaram haminja. lotfan rahnamee konid ke man chetori mitoonam in moshkel ro bar taraf konam.
albate hengame view dorost amal mikone vali moqe change shodan ba moshkele zir bar khord mikone.
ERROR:
Specified time is not supported in this calendar. It should be between 03/21/0622 00:00:00 (Gregorian date) and 12/31/9999 23:59:59 (Gregorian date), inclusive.
Parameter name: time
(dateshamsi = 1388/04/24)
|
|
|
|
 |
|
 |
telerik doesn't correctly support Globalization. For example, some error appear when you use hijri calendar. Even you can see those in their samples.
|
|
|
|
 |
|
 |
this is one of the best solutions that i see,very good !
Take it easy !
|
|
|
|
 |
|
 |
Hi Reza
There is a simple bug in your code . your code is under C# , so you must declare '@' before strings.
I correct this Code Like this :
public static void InitPersianDateTimeFormat(DateTimeFormatInfo info)
{
if (info == null)
return;
PersianCalendar calendar = new PersianCalendar();
bool readOnly = (bool)dateTimeFormatInfoReadOnly.GetValue(info);
if (readOnly)
{
dateTimeFormatInfoReadOnly.SetValue(info, false);
}
dateTimeFormatInfoCalendar.SetValue(info, calendar);
object obj2 = dateTimeFormatInfoCultureTableRecord.GetValue(info);
cultureTableRecordUseCurrentCalendar.Invoke(obj2, new object[] { calendarID.GetValue(calendar, null) });
info.AbbreviatedDayNames = new string[] { "ی", "د", "س", "چ", "پ", "ج", "ش" };
info.ShortestDayNames = new string[] { "ی", "د", "س", "چ", "پ", "ج", "ش" };
info.DayNames = new string[] { "یکشنبه", "دوشنبه", "ﺳﻪشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه" };
info.AbbreviatedMonthNames = new string[] { "فروردین", "ارديبهشت", "خرداد", "تير", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
info.MonthNames = new string[] { "فروردین", "ارديبهشت", "خرداد", "تير", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند", "" };
info.AMDesignator = @"ق.ظ";
info.PMDesignator = @"ب.ظ";
info.FirstDayOfWeek = DayOfWeek.Saturday;
info.FullDateTimePattern = @"yyyy MMMM dddd, dd HH:mm:ss";
info.LongDatePattern = @"yyyy MMMM dddd, dd";
info.ShortDatePattern = @"yyyy/MM/dd";
if (readOnly)
{
dateTimeFormatInfoReadOnly.SetValue(info, true);
}
}
Please Correct The Code and Recompile and Generate New .nlp .
Its so Useful for me , Thanks And Regards.
With Best Regards.
Saeed tabrizi
|
|
|
|
 |
|
 |
'@' char symbol shouldn't be important. Because declared strings of my code doesn't have '\'. Please explain incorrect functionality for me.
Unfortunately , .Net framework doesn't work correctly in custom culture. When I set some property of CultureAndRegionInfoBuilder and register it, replaced CultureInfo doesn't have these properties. This problem confused me; I don't know how to solve this problem.
About your problem to set Available Calendars: I solve it by a way that I used this way to add Persian calendar to SharePoint. Unfortunately, this way is private. I interest to answer other questions if you have.
For more info, please review www.artofprogramming.blogfa.com
|
|
|
|
 |
|
 |
Not up to CP standards. Should have been reworked before being approved.
|
|
|
|
 |
|