<%@ WebHandler Language="C#" Class="CustomMenuSave" %> using System; using System.Collections.Generic; using System.Web; using System.Data; using System.IO; using eMIS.Data; using System.Data.Common; using System.Web.SessionState; using eMIS; using System.Text; public class CustomMenuSave : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { string path = context.Server.MapPath("./"); string[] colors = new string[5]; colors[0] = "spr,#EDF6F3,#4CAC86,#2B9D79,#38997A,#4FAF89,#EFF8F7,#FDFDFF,#EDF6F3,#B9E0CE,#70BD9E"; colors[1] = "sum,#EEF6F9,#7FB2D1,#81B4D3,#81B4D3,#4FAF89,#EFF8F7,#FDFDFF,#EDF6F3,#A5CADD,#81B4D3"; colors[2] = "fal,#EDF6F3,#4CAC86,#2B9D79,#38997A,#4FAF89,#EFF8F7,#FDFDFF,#EDF6F3,#BFD9E6,#81B4D3"; colors[3] = "win,#EDF6F3,#4CAC86,#2B9D79,#38997A,#4FAF89,#EFF8F7,#FDFDFF,#EDF6F3,#BFD9E6,#81B4D3"; colors[4] = "dft,#EDF6F3,#4CAC86,#2B9D79,#38997A,#4FAF89,#EFF8F7,#FDFDFF,#EDF6F3,#BFD9E6,#81B4D3"; StreamReader sr = new StreamReader(path+"spr\\default.css", Encoding.UTF8); string content = sr.ReadToEnd(); string s; StreamWriter sw; string[] a0=colors[0] .Split(','); string[] a; int ii; for (int i = 1; i < 5; i++) { a = colors[i].Split(','); s = content; sw = new StreamWriter(path+""+a[0]+"\\default.css",false, Encoding.UTF8); for (ii = 1; ii < a.Length; ii++) s = s.Replace(a0[ii], a[ii]); sw.Write(s); sw.Close(); } sr.Close(); context.Response.Write("ok"+DateTime.Now.ToString()); } public bool IsReusable { get { return false; } } }