>[WebMethod(Description = "Set server Event Log sources.")] >public string SetEventLogSources(string Username, string Password, string Domain) >{ > //This will keep track of the impersonation token > const int LOGON_TYPE_INTERACTIVE = 2; > const int LOGON_TYPE_PROVIDER_DEFAULT = 0; > string logName = "Application"; > IntPtr userToken = IntPtr.Zero; > > if (LogonUser(Username, Domain, Password, LOGON_TYPE_INTERACTIVE, LOGON_TYPE_PROVIDER_DEFAULT, ref userToken)) > { > //Initialize user token > WindowsIdentity oIdentity = new WindowsIdentity(userToken); > WindowsImpersonationContext oContext = oIdentity.Impersonate(); > > foreach (string source in Enum.GetNames(typeof(Events.EventSources))) > { > if (EventLog.SourceExists(source) == false) > EventLog.CreateEventSource(source, logName); > } > > //Undo impersonation > oContext.Undo(); > > return "Event source registration successful!"; > } > else > { > return "Unable to process user credentials for event source registration."; > } >} >>
EventLog.CreateEventSource(source, logName);But not sure if I used the right values as parameters. I have made a point to find a good article on this topic to understand it better. I have solved my initial problem by creating a bunch of simple text files with messages. In the beginning I didn't think the ASP.NET would allow me to do it on the Server 2003; but it was no problem. As a side note, I was so upset with myself that after several hours of troubleshooting this problem, I found that the cause was missing letter "l" in one of the keys of WEB.CONFIG on the customer site. The good thing is that I learned something new and hopefully will learn more new stuff.