From 8fea1ef63f2210313447e687df270d5b46d3786d Mon Sep 17 00:00:00 2001 From: zhanghangjian <18055524621@163.com> Date: Thu, 9 Jan 2025 15:09:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=8C=E6=88=90=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E8=A7=A6=E5=8F=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/FineUIPro.Web/ErrLog.txt | 81 +++ SGGL/FineUIPro.Web/Login.aspx | 862 +++++++++----------------- SGGL/FineUIPro.Web/Login.aspx.cs | 3 +- SGGL/FineUIPro.Web/common/PageBase.cs | 45 +- 4 files changed, 395 insertions(+), 596 deletions(-) diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt index d28478b4..3263c152 100644 --- a/SGGL/FineUIPro.Web/ErrLog.txt +++ b/SGGL/FineUIPro.Web/ErrLog.txt @@ -3160,3 +3160,84 @@ IP地址:::1 出错时间:11/27/2024 19:32:54 + +错误信息开始=====> +错误类型:HttpException +错误信息:不允许使用类似“<%$ Resources:Lan, Login %>”的文本表达式。请改用 。 +错误堆栈: + 在 System.Web.UI.TemplateParser.ProcessError(String message) + 在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) + 在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) +出错时间:01/08/2025 11:15:42 +出错文件:http://localhost:1295/Login.aspx +IP地址:::1 + +出错时间:01/08/2025 11:15:42 + + +错误信息开始=====> +错误类型:HttpException +错误信息:类型“Login”的控件“ctl01”必须放在具有 runat=server 的窗体标记内。 +错误堆栈: + 在 System.Web.UI.Page.VerifyRenderingInServerForm(Control control) + 在 System.Web.UI.WebControls.Login.Render(HtmlTextWriter writer) + 在 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) + 在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) + 在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) + 在 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) + 在 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) + 在 System.Web.UI.Page.Render(HtmlTextWriter writer) + 在 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) + 在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) + 在 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:01/09/2025 02:19:36 +出错文件:http://localhost:1295/Login.aspx +IP地址:::1 + +出错时间:01/09/2025 02:19:36 + + +错误信息开始=====> +错误类型:HttpException +错误信息:不允许使用类似“<%$ Resources:Resources,Login %>”的文本表达式。请改用 。 +错误堆栈: + 在 System.Web.UI.TemplateParser.ProcessError(String message) + 在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) + 在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) +出错时间:01/09/2025 02:25:08 +出错文件:http://localhost:1295/Login.aspx +IP地址:::1 + +出错时间:01/09/2025 02:25:08 + + +错误信息开始=====> +错误类型:HttpParseException +错误信息:未找到键为“Login”的资源对象。 +错误堆栈: + 在 System.Web.UI.TemplateParser.ProcessException(Exception ex) + 在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) + 在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) +----错误类型:HttpException +----错误信息: +----未找到键为“Login”的资源对象。 +----错误堆栈: + 在 System.Web.Compilation.ResourceExpressionBuilder.ParseExpression(String expression, Type propertyType, ExpressionBuilderContext context) + 在 System.Web.UI.BoundPropertyEntry.ParseExpression(ExpressionBuilderContext context) + 在 System.Web.UI.ControlBuilder.FillUpBoundPropertyEntry(BoundPropertyEntry entry, String name) + 在 System.Web.UI.ControlBuilder.AddBoundProperty(String filter, String name, String expressionPrefix, String expression, ExpressionBuilder expressionBuilder, Object parsedExpressionData, Boolean generated, String fieldName, String formatString, Boolean twoWayBound, Boolean encode, Int32 line, Int32 column) + 在 System.Web.UI.ControlBuilder.AddBoundProperty(String filter, String name, String expressionPrefix, String expression, ExpressionBuilder expressionBuilder, Object parsedExpressionData, String fieldName, String formatString, Boolean twoWayBound, Boolean encode, Int32 line, Int32 column) + 在 System.Web.UI.ControlBuilder.PreprocessAttribute(String filter, String attribname, String attribvalue, Boolean mainDirectiveMode, Int32 line, Int32 column) + 在 System.Web.UI.ControlBuilder.PreprocessAttributes(ParsedAttributeCollection attribs) + 在 System.Web.UI.ControlBuilder.Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs) + 在 System.Web.UI.ControlBuilder.CreateBuilderFromType(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs, Int32 line, String sourceFileName) + 在 System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty) + 在 System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText) + 在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) +出错时间:01/09/2025 02:29:04 +出错文件:http://localhost:1295/Login.aspx +IP地址:::1 + +出错时间:01/09/2025 02:29:04 + diff --git a/SGGL/FineUIPro.Web/Login.aspx b/SGGL/FineUIPro.Web/Login.aspx index 74a2766d..6e762d68 100644 --- a/SGGL/FineUIPro.Web/Login.aspx +++ b/SGGL/FineUIPro.Web/Login.aspx @@ -1,76 +1,39 @@ <%@ Page Language="C#" AutoEventWireup="True" CodeBehind="Login.aspx.cs" -Inherits="FineUIPro.Web.Login" %> + Inherits="FineUIPro.Web.Login" %> - + - - + + - - - + - + + diff --git a/SGGL/FineUIPro.Web/Login.aspx.cs b/SGGL/FineUIPro.Web/Login.aspx.cs index 850ed32b..37cacbdb 100644 --- a/SGGL/FineUIPro.Web/Login.aspx.cs +++ b/SGGL/FineUIPro.Web/Login.aspx.cs @@ -3,7 +3,9 @@ using BLL; using System; using System.Configuration; + using System.Globalization; using System.Linq; + using System.Threading; using System.Web; using System.Web.Services; @@ -65,7 +67,6 @@ { if (!IsPostBack) { - } } #endregion diff --git a/SGGL/FineUIPro.Web/common/PageBase.cs b/SGGL/FineUIPro.Web/common/PageBase.cs index 3cfaac58..8450ae38 100644 --- a/SGGL/FineUIPro.Web/common/PageBase.cs +++ b/SGGL/FineUIPro.Web/common/PageBase.cs @@ -4,10 +4,12 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; +using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Text; +using System.Threading; using System.Web; using System.Web.UI; using AspNet = System.Web.UI.WebControls; @@ -44,6 +46,32 @@ namespace FineUIPro.Web #region OnInit + /// + /// 初始化多语言资源 + /// + protected override void InitializeCulture() + { + + HttpCookie langCookie = Request.Cookies["Language"]; + // 默认为中文 + var langName = "zh-CN"; + if (langCookie != null) + { + // 简单的转换:zh_CN -> zh-CN + langName = langCookie.Value.Replace("_", "-"); + if (langName == "en") + { + langName = "en-US"; + } + } + // 设置语言 + var cultureInfo = CultureInfo.CreateSpecificCulture(langName); + Thread.CurrentThread.CurrentCulture = cultureInfo; + Thread.CurrentThread.CurrentUICulture = cultureInfo; + + base.InitializeCulture(); + } + protected override void OnInit(EventArgs e) { string url = HttpContext.Current.Request.Path; @@ -93,21 +121,6 @@ namespace FineUIPro.Web } } - HttpCookie langCookie = Request.Cookies["Language"]; - if (langCookie != null) - { - string langValue = langCookie.Value; - try - { - // 是否为内置语言 - pm.Language = (Language)Enum.Parse(typeof(Language), langValue, true); - } - catch (Exception) - { - pm.CustomLanguage = langValue; - } - } - // 1. 仅显示基础版示例, 2. 基础版 // 上述两种情况都要禁用EnableAnimation、DisplayMode、MobileAdaption bool showOnlyBase = false; @@ -206,6 +219,8 @@ namespace FineUIPro.Web //} } + + /// /// UNLOAD事件,发生在页面装载顺序的最后。 /// 在这里处理的是DBLIST,数据库连接字典。