File manager - Edit - G:/PleskVhosts/indiaminerals.in/vgm.INFOFIXDEVELOPERS.COM/admin/Logs_Report.aspx.cs
Back
using System; using System.IO; using System.Collections.Generic; using System.Web; using System.Web.Services; using WebApp.LIBS; namespace WebApp.admin { public partial class Logs_Report : BasePageClass { static string logFilePath = "~/data/LogData.csv"; protected void Page_Load(object sender, EventArgs e) { // Any additional initialization code can be added here if needed } [WebMethod] public static string GetLogData(string logFilePath) { try { string filePath = HttpContext.Current.Server.MapPath(logFilePath); List<Dictionary<string, string>> data = new List<Dictionary<string, string>>(); // Read the lines of the CSV file string[] lines = File.ReadAllLines(filePath); if (lines.Length > 0) { // Assume the first line contains column headers string[] headers = lines[0].Split(','); // Add data rows to the DataTable for (int i = 1; i < lines.Length; i++) { string[] rowValues = lines[i].Split(','); Dictionary<string, string> row = new Dictionary<string, string>(); for (int j = 0; j < headers.Length; j++) { row[headers[j].Trim('\"')] = rowValues[j].Trim('\"'); } data.Add(row); } } return Newtonsoft.Json.JsonConvert.SerializeObject(data); } catch (Exception ex) { // Log the exception for debugging and monitoring // Example: Logger.LogError("Error in GetLogData", ex); return ex.Message; } } } }
| ver. 1.4 |
Github
|
.
| PHP 7.3.33 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings