20220717 pagebase

This commit is contained in:
2022-07-17 09:15:38 +08:00
parent e8ad744948
commit 1f471c2f56
103 changed files with 28450 additions and 22 deletions
+80 -3
View File
@@ -3,6 +3,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.IO;
using System.Linq;
@@ -14,8 +15,46 @@ using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web
{
//必须要修改form传过来的F_STATE,否则加了__hook的base64编码无效识别
public static class GlobalValues
{
public static PropertyInfo NameObjectCollectionBaseIsReadOnly;
static GlobalValues()
{
Type type = typeof(NameObjectCollectionBase);
NameObjectCollectionBaseIsReadOnly = type.GetProperty(
"IsReadOnly",
BindingFlags.Instance | BindingFlags.NonPublic);
}
}
public class PageBase : System.Web.UI.Page
{
protected override void OnPreRenderComplete(EventArgs e)
{
base.OnPreRenderComplete(e);
foreach (var t in Assembly.GetAssembly(this.GetType()).GetTypes())
{
if (t.IsSubclassOf(typeof(PageBase)))
{
var fi = t.GetField("mainFrame", BindingFlags.NonPublic | BindingFlags.Instance);
if (fi != null)
{
var f = fi.GetValue(this) as System.Web.UI.HtmlControls.HtmlForm;
if (f != null)
{
Label l = new Label
{
Text = "<script>_oldParam = jQuery.param;jQuery.param = function (x) { var t = _oldParam(x); t = t.replace('F_STATE=', 'F_STATE=__hook'); return t;}</script>"
};
f.Controls.Add(l);
}
}
}
}
}
/// <summary>
/// 当前登录人信息。
/// </summary>
@@ -42,6 +81,25 @@ namespace FineUIPro.Web
}
}
protected override void OnPreInit(EventArgs e)
{
//增加修改权限
GlobalValues.NameObjectCollectionBaseIsReadOnly.SetValue(Request.QueryString, false, null);
GlobalValues.NameObjectCollectionBaseIsReadOnly.SetValue(Request.Form, false, null);
//修复__hook头标识
if (Request.Form["F_STATE"] != null)
{
var fs = Request.Form["F_STATE"];
if (fs.StartsWith("__hook"))
{
fs = fs.Substring(6);
Request.Form["F_STATE"] = fs;
}
}
}
#region OnInit
protected override void OnInit(EventArgs e)
@@ -182,11 +240,25 @@ namespace FineUIPro.Web
//anyway,its ok.
this.Title = BLL.Funs.SystemName;
//if (CurrUser == null)
if (CurrUser == null)
{
if (this.Page.Request.AppRelativeCurrentExecutionFilePath != "~/Login.aspx")
Response.Redirect("~/Login.aspx");
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
//var u = Request.ApplicationPath.TrimStart('/');
//u=u.TrimEnd('/');
//if (!string.IsNullOrEmpty(u)) { u = "/" + u; }
//try
//{
// if (this.Page.Request.AppRelativeCurrentExecutionFilePath != "~/Login.aspx")
// Response.Redirect("~/Login.aspx");
// MainForm.InnerHtml += "<script type='text/javascript' src='" + u + "/res/js/hook.js" + "'></script>";
//}
//catch { }
}
/// <summary>
@@ -201,6 +273,11 @@ namespace FineUIPro.Web
{
BLL.Funs.DBList.Remove(System.Threading.Thread.CurrentThread.ManagedThreadId);
}
if (BLL.SQLHelper.GetConn().State == ConnectionState.Open)
{
BLL.SQLHelper.GetConn().Close();
}
}
private bool IsSystemTheme(string themeName)