views:

45

answers:

1

Hi

  1. How to write Log to Windows Log file ? (Windows XP)

  2. How to find the Virtual Directory of my Web service (from the Web service) ?

thank's in advance

+1  A: 

Writing to event log:

System.Diagnostics.EventLog.CreateEventSource(strMyApp, "Application");
EventLog MyEventLog = new EventLog();
MyEventLog.Source = strMyApp;
MyEventLog.WriteEntry(strEvent, EventLogEntryType.Warning);

Find virtual directory:

http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.mappath.aspx

James
Note that creating an event source under Windows Vista or Windows Server 2008 may not work unless you run with elevated (Administrator) privileges. See http://stackoverflow.com/questions/712203/writing-to-an-event-log-in-asp-net-on-windows-server-2008-iis7/712214 for the gory details.
Jeremy McGee