Event Log : Inaccessible logs

 I am getting exception

The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.

at if (!EventLog.SourceExists(eventSource)) at function WriteExceptionToEventLog

If i login as windows administrator no problem.

If i login as user there the problem occures.

        catch (Exception ex)
            _objEventLogManager = new EventLogManager();

            //string innerException = Server.GetLastError().InnerException.ToString();
            //string innerException = ex.InnerException.ToString();
            string url = Convert.ToString(Request.Url);
            int userId = Convert.ToInt32(Session["CompanyID"]);
            DateTime daate = DateTime.Now;
            string functionName = Convert.ToString(ex.TargetSite);//Function Name


            _objEventLogManager.WriteExceptionToEventLog(ex.Source, Convert.ToString(ex.Message), 10);

    public void WriteExceptionToEventLog(string eventSource, Exception e, int eventId)
            System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog();
            if (!EventLog.SourceExists(eventSource))
                //Pass the source of the Error and the event log name
                EventLog.CreateEventSource(eventSource, EventLogManager.EVENT_LOG_NAME_APPLICATION);

            eventLog.Log = eventSource;
            eventLog.Source = eventSource;

            eventLog.WriteEntry("Message: " + e.Message + " Stack Trace: " + e.StackTrace, EventLogEntryType.Error, eventId);

            //If the Inner Exception value is not null then call the Exception method again.
            if (e.InnerException != null)
                WriteExceptionToEventLog(eventSource, e.InnerException, eventId);

    public void WriteExceptionToEventLog(string eventSource, string Error, int eventId)
            System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog();

            if (!EventLog.SourceExists(eventSource))
                EventLog.CreateEventSource(eventSource, EventLogManager.EVENT_LOG_NAME_APPLICATION);

            eventLog.Log = EventLogManager.EVENT_LOG_NAME_APPLICATION;
            eventLog.Source = eventSource;

            eventLog.WriteEntry("Message: " + Error, EventLogEntryType.Error, eventId);

The example is from Professional ASP.NET 2.0 Special Edition.

Please help me to recover the problem.

5/8/2008 12:00:05 PM
asp.net.custom-server-controls 3498 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 2
Get it on Google Play
Get it on Apple App Store

 Isn't that basic windows security?

administrator = super user

You have to have permission to fo so. 

5/14/2008 6:56:10 AM

Similar Artilces:

Events are being logged to the "Application" log instead of custom log
Hi Pros, I have a weird problem here. I am logging from my .NET app to a custom log, but unfortunately, the events are redirected to the Application log. I am sure that I am specifying the log name and the source name accurately. I am using some code like the following:  1 Hi Pros, 2 3 I have a weird problem here. I am logging from my .NET app to a custom log, but unfortunately, the events are redirected to the Application log. I am sure that I am specifying the log name and the source name accurately. I am using some code like the following: 4 5 6 EventLog e...

problems listenening to events on a custom server control from another custom server control
 Hi all,I am having problems listening to events on one of custom server controls(AddBookmark) from another custom server control(BookmarkList). The listener or the BookmarkList control has a property that can be set to the AddBookmark control (string at design but the reference is obtained at run-time). I am able to get a reference to the AddBookmark control and add a listener to it on the BookmarkList control on the OnPrender of BookmarkList. But the problem is that when the events on AddBookmark gets fired, the listener added from the BookmarkList is no longer present and the listene...

Event Log not Logging ??
 Hi All, On my dev machine when I log errors to the event log all works great however when I move the web application to the test server the events are not being logged... I am hoping it is some configuration issue with IIS however I am totally lost.The code writing the events: EventLog.WriteEntry("xxxxx", err, EventLogEntryType.Error);   Any help will be appreciated. Thanks,Neil  are you getting an error? Sometimes, its a permissions issue, if the log name doesn't exist, it tries to write the new value to the registry. Check the application log...

ExceptionPolicy logs differently to event log than to text log
I am implementing an exception policy in the business layer and in the presentation layer of my web application as per the block below.  When an exception happens in the business layer, it bubbles on up to the aspx, which in turn throws the error, thus invoking the default error page defined in web.config.  All well and good.  The strangeness is that only one exception is logged to the event log, but both throws are caught in the text log.  Why the discrepancy? Thanks.    Catch ex As Exception Dim rethrow As Boolean re...

Logged In As: Not Logged In
I installed ZCF 10.0.1 on a Win 2K3 server and when I install the ZEN client on a workstation the ZENWORKS client login comes up and I cannot log into it. It shows me the realm name of my tree and Zenworks Zone and I have tried both to no avail. When I look at the details of the adaptive agent it says, "Logged In As: Not Logged In" Any ideas? On Fri, 11 Jan 2008 14:55:21 GMT, Jayson E. Hahn wrote: > Any ideas? Debug logs in ZCM http://www.novell.com/support/search.do?cmd=displayKC&docType=kc&externalId=3418069&sliceId=SAL_Public&dialogID=51010132...

The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
  I get the above mentioned error when running my app.  I have run out of possible solutions (I've given the app the proper rights to folders, set up the event, etc.).Any ideas how else this can be resolved, or what the issue is? hi newbieAl, i think your solution is link below, http://scottonwriting.net/sowblog/posts/3406.aspx http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=324053&SiteID=1 i hope this help you..ihsany######Make It Easy--------------dont forget to click <Mark As Answer>------------------  I believe the first solution does not apply ...

To log or not to log
Hello foremen, on a large database, trillions of SELECTs and DELETEs are going to be performed. After that, the database is going to be unloaded. The database uses a transaction log. Should I keep the log there along this process or "unmount" it after some parts of it (or even before the beginning)? In this case, nothing but the speed is important. The database is ASA Thanks Pavel LOG... ALWAYS LOG. Performance is dependent on the use of the log. Recommendations: 1) Ensure that the file system is not excessively fragmented 2) Host the db f...

Logging log
Hi! I try to accomplish task described in http://forums.novell.com/novell-product-support-forums/zenworks/configuration-management/zcm-server-install/422609-mixed-login.html?pagenumber= and wonder I don't know how to keep log of logging? I mean, does ZCM is capable to keep logging log? As Altiris NS does? More thanks, Alar. -- NovAlf ------------------------------------------------------------------------ You look like you want to log in to your zone as a user from either a eDIR or AD. And yes this is possible, it will search both Directories. http://www.theurbanp...

Can log in with developer server but cannot log in with actual server
Dear all,I tried to create the login process and it worked. However, when I tried to use the webpage login.aspx without using the developer server, only the "login.aspx" would work. I typed in my name and pw, and when the page suppose to be redirected to a login page, it shows that this page cannot be found.Could some one help me on this?...

Activity log not logging any events
Hi i have installed the VBSDK kit and it is succesfully running but the activity log does not appear to log any activity, any help in this aspect would be greatly apreciated, Chris The activity log isn't heavily used in the CSK. Mostly it will only log errors related to sending mail or with web services and web service boxes. Generally, if you have no entries in there, it is a good thing.Stephen M. Redd http://www.reddnet.net...

System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
I have tried for 2 hours to get rid of this error when trying to log into my app.  Sometimes when I just refresh our login page I get this also   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.  Inaccessible log...

Custom event for Custom server control
  Hi All, I have a custom server control (Multi selection drop downlist). This control contains AspxEditButton control(which is like textbox with button), check box list control and panel.I have to display all selected values in AspxEditButton at control is leaving that panel. How can i create LostFocus event for panel . Please anyone help meRegards, Anu All I can think of, is that there is a javascript "onblur" you could look into, maybe you could use some AJAX techniques to make that JavaScript event fire a server side ev...

Custom Events in Custom Server Control
 Hi There I've created a custom server control. I have extended it by adding my own event which fires in one of the aggregated control's event handlers. My probelms is that I would like to be able to specify the event handler for the event from the aspx file as a tag attribute.Does anyone know how to link the attribute of a customer server control tag in the aspx file to a custom event in the class source for the control?   I've done this several times with Custom Controls.  All I do is declare the event in the CustomControl's class public...

Creating a Custom Event Log in a VS.NET deployment project
I have a web site i want to deploy using a VS.NEt set up project. I have no problems with that, that is fine and works no problem. But the web application uses a custom event log to log application messages. The asp.net application will not be running under an account with administrative permissions and so this will not be able to create the custom event log. So i wanted to be able to create this during the setup program. As this will have to be run using an admisitrative account. Can this be done? How can it be done? Any help would be gratefully appreciated. Thanks Ant ht...

Web resources about - Event Log : Inaccessible logs - asp.net.custom-server-controls

Inaccessible Island - YouTube
Landing on Inaccessible Island, one of the remotest islands on earth, so not an easy place to get to, and not an place to land (hence the name). ...

Soaring rents make 'cheap' Melbourne suburbs inaccessible: Council to Homeless Persons
Melbourne has long been an expensive place to find a home, but now low-income renters have been squeezed out of even the city's poorest suburbs ...

Canada's top judge slams 'inaccessible justice'
Supreme Court of Canada Chief Justice Beverley McLachlin says the most pressing challenge facing the administration of justice in this country ...

10 more victims of MH17 identified, crash site still inaccessible
10 more victims of MH17 identified, crash site still inaccessible People's Daily Online This week another 10 victims of the MH17 flight disaster ...

App Store, iTunes Store, Apple TV features currently facing server problems, inaccessible for some users ...
Apple’s cloud media services are currently facing various server issues that are resulting in content being unavailable for many users. We’ve ...

SysExporter 1.60 grabs data stored in otherwise inaccessible Windows controls
NirSoft has released SysExporter 1.60 , the latest version of an interesting tool that allows you to grab data stored in otherwise inaccessible ...

Wingnut PAC Slams Clinton Campaign Rally At "Inaccessible" Roosevelt Island
As you probably know by now, tomorrow Hillary Clinton will stage a campaign rally on New York City's Roosevelt Island, which is in the East River ...

Reuters websites become inaccessible in China
The news websites of Reuters were inaccessible in China on Friday, after users first experienced difficulties accessing them late on Thursday. ...

New York Times site still inaccessible for some after hack
The Times' website went down for several hours Tuesday after being hit by an attack for which the Syrian Electronic Army, a hacktivist group, ...

DOJ Targeted Public Library for Lending E-Books 'Inaccessible' to the Blind
By: Elizabeth Harrington Barnes & Noble's NOOK Color read more

Resources last updated: 12/4/2015 5:45:37 PM