<%@ WebHandler Language="C#" Class="CheckPriKey" Debug="true" %> using System; using System.Collections.Generic; using System.Web; using System.Data; using System.IO; using eMIS.Data; using System.Data.Common; using System.Text; using System.Web.SessionState; using eMIS; public class CheckPriKey : IHttpHandler, IRequiresSessionState { public void ProcessRequest (HttpContext context) { string objectId = context.Request.QueryString["oid"].ToString(); string recordId = context.Request.QueryString["rid"].ToString(); DataManager dm = new DataManager(); BusinessObjectManager businessObject = new BusinessObjectManager(dm, objectId); string menuId = businessObject.MenuID; recordId = businessObject.GetProgramPrimaryKeyValueByObjectValue(recordId); string wwwroot = context.Request.ApplicationPath; if (wwwroot == "/") wwwroot = ""; if (menuId == "") { context.Response.ContentType = "text/plain"; context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.Write("未发现对象:" + objectId); } else { DataTable dt = dm.Operator.ExecuteTable("select a.dzlbdyym,a.DZDYYM from com_aspsjgl_zb a,com_xtcdb b where a.id=b.cxid and b.id=" + menuId); string rid = ""; string url = ""; if (dt.Rows.Count!=0) { rid = dt.Rows[0][0].ToString(); url = dt.Rows[0][1].ToString(); } if (url=="" || url.IndexOf(".") == -1) { if (url != "") { url = "../../common/reports/page.aspx?reportid=" + url + "&id=" + recordId + "&r=" + DateTime.Now.Ticks.ToString(); } else { url = "CustomPageDisplay.ashx?proid=" + menuId + "&recid=" + recordId + "&r=" + DateTime.Now.Ticks.ToString(); } } else { url = wwwroot + url+(url.IndexOf("?")==-1?"?":"&") + "proid=" + menuId + "&recid=" + recordId + "&r=" + DateTime.Now.Ticks.ToString();; } context.Response.Redirect(url); } } public bool IsReusable { get { return false; } } }