2014年7月13日 星期日

[RESOLVED] Security Exception


hi,


my error is:


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: The source was not found, but some or all event logs could not be searched.  To create the source, you need permission to read all event logs to make sure that the new source name is unique.  Inaccessible
logs: Security.



               EventLog log = new EventLog();
log.Source = "Default page";
log.WriteEntry(err.Message, EventLogEntryType.Error);

error in : log.WriteEntry(err.Message, EventLogEntryType.Error);



how to fix it ?


thanks



Hello,


You cannot access Event Log unless your website is with High Trust Level. If you are on a shared hosting environment, this is not going to be easy set by your provider.


Why you don't use db or files in your logging?



hi


It is
a practice.i run website in localhost.

To
resolve this problem,
what to
do?


sorce:asp.net 4.5 in C# from novice to pro.. (apress)




Chapter
7


How to Register logs in windows events logs



Hi Sobhan,


From the error message it is clearly shows it is the permission issue. Please kindly try to grant the permission.


沒有留言:

張貼留言