zoukankan
html css js c++ java
ASP.NET 开发, PageBase, ModuleBase
using
System;
using
System.Web.UI;
public
class
ApplicationConfiguration : IConfigurationSectionHandler
{
public
Object Create(Object parent,
object
configContext, XmlNode section)
{
//
}
public
static
void
OnApplicationStart(String myAppPath)
{
appRoot
=
myAppPath;
//
init ApplicationConfiguration & call it's Create message
System.Configuration.ConfigurationSettings.GetConfig(
"
ApplicationConfiguration
"
);
}
}
public
class
Global : System.Web.HttpApplication
{
protected
void
Application_Start(Object sender, EventArgs e)
{
//
do something at Application Start
ApplicationConfiguration.OnApplicationStart(Context.Server.MapPath(Context.Request.ApplicationPath));
}
}
/**/
///
<summary>
///
All pages base class
///
</summary>
public
class
PageBase : Page
{
public
const
String KEY_CACHEUSER
=
"
Cache::User
"
;
private
static
String pageSecureUrlBase;
//
for securite http, that is: https
private
static
String pageUrlBase;
private
static
String urlSuffix;
public
PageBase()
{
try
{
string
strPort
=
(Context.Request.Url.Port
==
80
?
""
: String.Format(
"
:{0}
"
, Context.Request.Url.Port));
string
strApp
=
(Context.Request.ApplicationPath
==
"
/
"
?
""
: Context.Request.ApplicationPath);
this
.urlSuffix
=
Context.Request.Url.Host
+
strPort
+
strApp;
this
.pageUrlBase
=
@"
http://
"
+
urlSuffix;
}
catch
{
//
for design time
}
}
public
static
String UrlBase
{
get
{
return
pageUrlBase; }
}
public
UserInfo SignInUser
{
get
{
try
{
return
(UserInfo)Session[KEY_CACHEUSER]; }
catch
{
return
null
;
/**/
/*
for design time
*/
}
}
set
{
if
(
null
==
value)
{ Session.Remove(KEY_CACHEUSER); }
else
{ Session[KEY_CACHEUSER]
=
value; }
}
}
protected
override
void
OnError(EventArgs e)
{
//
todo your error handle code here
//
..
//
and determind if call base OnError message or not
//
base.OnError(e);
}
}
/**/
///
<summary>
///
All user controls base class
///
</summary>
public
class
ModuleBase : UserControl
{
private
String basePathPrefix;
public
String PathPrefix
{
get
{
if
(
null
==
basePathPrefix)
{ basePathPrefix
=
PageBase.UrlBase; }
return
basePathPrefix;
}
set
{
basePathPrefix
=
value;
}
}
public
UserInfo SignInUser
{
get
{
try
{
return
(UserInfo)Session[PageBase.KEY_CACHEUSER]; }
catch
{
return
null
;
/**/
/*
for design time
*/
}
}
set
{
if
(
null
==
value)
{ Session.Remove(PageBase.KEY_CACHEUSER); }
else
{ Session[PageBase.KEY_CACHEUSER]
=
value; }
}
}
}
查看全文
相关阅读:
UITextField editingDidEnd 不调用(不响应)
修改 Navigation Bar 返回按钮文字和图片
HTTPS抓包
brew 基本使用方法
Linux基本命令
AR 初探
汇编学习
ios GCD ---- (1)
axios导出或者下载
Vue绑定图片src出现的问题
原文地址:https://www.cnblogs.com/hcfalan/p/500752.html
最新文章
constraintLayout
夜间模式
android studio配置安装及 jdk配置安装
克隆git代码第一次导入到项目·
path实现揭露动画
View的四个构造器
LayoutInflater
插值器,估值器
h2数据库使用笔记
FileUitls
热门文章
服务异常返回的设计
Git恢复指定文件
使用反射机制创建带构造参数的对象
在当前光标处按指定属性显示字符
使用JDK自带的MessageDigest计算消息摘要
将字节数组转换成十六进制字符串表示
使用ReflectionToStringBuilder实现toString方法
服务返回码的设计
记录一次iOS打包出现的问题
@testable import No such module 'XXX'
Copyright © 2011-2022 走看看