Link to home
Start Free TrialLog in
Avatar of dileepav
dileepavFlag for India

asked on

System.ComponentModel.win32, access denied error message in dotnet?

Hi Experts,

I am getting System.ComponentModel.win32 exception dotnet, access denied error message when I run the following code snippet.

public void WriteToEventLog( Exception objError)
            {
                  //*********************************************************************
                  //* Purpose:Writing error to the windows event log                    *
                  //* Input parameters:                                                 *
                  //*                         objError----Exception object                     *
                  //* returns :                                                                                    *
                  //*                        nothing                                            *
                  //* *******************************************************************            

                  System.Diagnostics.EventLog objEventLog = new System.Diagnostics.EventLog();
                  objEventLog.Source = "SMF";
                  objEventLog.WriteEntry(objError.Message.ToString());
            }

Do anybody know the reason for this error?

Thanks
Dil
ASKER CERTIFIED SOLUTION
Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dileepav

ASKER

Hi Experts,

Your tips guided me in solving the problem.