Click here to Skip to main content
15,892,059 members
Articles / Web Development / HTML

Implementing WS-SecureConversation in Microsoft IssueVision

Rate me:
Please Sign up or sign in to vote.
4.61/5 (12 votes)
27 Sep 20056 min read 73.3K   776   38  
Adding secure communications to the Microsoft IssueVision sample application using WSE 2.0.
using System;
using System.Diagnostics;

namespace IssueVisionWebWseCS
{
	// Windows event log helper.
	public class EventLogHelper
	{
		private readonly static string m_eventLogSource = "IssueVision Web Service 1.0";

		private EventLogHelper()
		{
		}

		// Checks for the existing of an event source. Returns true if the event 
		// source exists; otherwise false is returned.
		public static bool Exists(string eventSourceName)
		{
			return EventLog.Exists(eventSourceName);
		}

		// Creates an event source name for the windows application event log.
		public static void CreateSource(string eventSourceName)
		{
			if (EventLog.Exists(eventSourceName) == false)
			{
				EventLog.CreateEventSource(eventSourceName, "Application");
			}
		}

		// Removes an event source name from the windows application event log.
		public static void RemoveSource(string eventSourceName)
		{
			if (EventLog.Exists(eventSourceName))
			{
				EventLog.DeleteEventSource(eventSourceName, "Application");
			}
		}

		// Logs an error to the application log.
		public static void LogError(string message)
		{
			LogEvent(m_eventLogSource, message, EventLogEntryType.Error);
		}

		// Logs a failure audit message to the application event log.
		public static void LogFailureAudit(string message)
		{
			LogEvent(m_eventLogSource, message, EventLogEntryType.FailureAudit);
		}

		// Logs a sucess audit message to the application event log.
		public static void LogSuccessAudit(string message)
		{
			LogEvent(m_eventLogSource, message, EventLogEntryType.SuccessAudit);
		}

		// Logs a warning message to the application event log.
		public static void LogWarning(string message)
		{
			LogEvent(m_eventLogSource, message, EventLogEntryType.Warning);
		}

		// Logs an information message to the application event log.
		public static void LogInformation(string message)
		{
			LogEvent(m_eventLogSource, message, EventLogEntryType.Information);
		}

		// Log an message to the Windows Application Event Log with a specified type.
		private static void LogEvent(string eventLogSource, string message, EventLogEntryType eventLogEntryType)
		{
			EventLog.WriteEntry(eventLogSource, message, eventLogEntryType);
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
United States United States
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET

Comments and Discussions