Implement Logger in asp.net

First of create LoggingConstant.cs File in that Declare all Pages name as variable without extension. For ex. public enum ModuleToLog { default, login } public enum LogType { DEBUG, EXCEPTION, INFO } After that create Logger.cs File.. public class Logger { public static void Write(LogType eLogType, ModuleToLog eModule, string strMethodName, string LogMessage, string strUserId) { …

Windows Users List in Asp.Net c#

using System.Management; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { SelectQuery query = new SelectQuery(“Win32_UserAccount”); ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); foreach (ManagementObject envVar in searcher.Get()) { Console.WriteLine(“Username : {0}”, envVar[“Name”]); } Console.ReadLine(); } } }

create xml file dynamically

try { if (System.Web.HttpContext.Current.Session[“UserId”] != null && System.Web.HttpContext.Current.Session[“EventId”] != null && System.Web.HttpContext.Current.Session[“EventConfiguration”] != null) { Logger.Write(LogType.INFO, ModuleToLog.EventInformation, “WriteEventHistory”, “EventHistory”, HttpContext.Current.Session[“UserName”].ToString()); string pageName = System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.ServerVariables[“SCRIPT_NAME”]); UserService.UserClient proxyFind = new ePlannerPro2Client.UserService.UserClient(); epp2ClientPL.UsersProperties result = proxyFind.LoadById(new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“UserId”])), new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“EventId”]))); if (result == null) { return; } //epp2ClientPL.UsersProperties result = proxyFind.LoadUsersByEventId(new Guid(Convert.ToString(Convert.ToString(System.Web.HttpContext.Current.Session[“EventId”])))).Where(u => u.UserId.Equals(new Guid(Convert.ToString(System.Web.HttpContext.Current.Session[“UserId”])))).SingleOrDefault(); epp2ClientPL.EventConfigurationProperties files = (epp2ClientPL.EventConfigurationProperties)System.Web.HttpContext.Current.Session[“EventConfiguration”]; …