专业网站建设品牌,17年专业建站经验,服务6000+客户--广州松河
免费热线:400-963-0016
微信咨询
|
联系我们
扫二维码关注公众号
网站首页
网站建设
短视频
网站推广
网站模板
客户案例
资讯动态
关于我们
网站首页
网站建设
短视频
网站推广
网站模板
客户案例
资讯动态
关于我们
位置:
广州松河
>
技术支持
> httpModule控制url跳转
httpModule控制url跳转
来源:网络整理 时间:2023/2/14 0:51:31 共
3652
浏览
httpModule控制url权限的使用方法代码如下:
using
System;
using
System.Web;
using
System.Data.SqlClient;
using
System.Data;
using
CNNet.CommonBLL;
///
<summary>
///
BasePage 的摘要说明
///
Create:wangxiaoming
///
Descri:网站权限控制模块
///
</summary>
namespace
MyModule
{
public
class
DEPHttpModule : System.Web.IHttpModule
{
public
void
Init(HttpApplication application)
{
application.AcquireRequestState
+=
(
new
EventHandler(
this
.Application_AcquireRequestState));
}
public
DEPHttpModule()
{
}
private
void
Application_AcquireRequestState(Object source, EventArgs e)
{
HttpApplication Application
=
(HttpApplication)source;
string
url
=
Application.Context.Request.Path;
String AppPath
=
Application.Context.Request.ApplicationPath;
#region
企业
if
(url.IndexOf(
"
company/pages/
"
)
>
0
)
{
CNNet.CommonBLL.Cookie cookie
=
new
CNNet.CommonBLL.Cookie();
string
userCode
=
cookie.getCookie(
"
cnnetcompanyname
"
);
string
companycode
=
cookie.getCookie(
"
cnnetcompanycode
"
);
if
(
string
.IsNullOrEmpty(userCode)
||
string
.IsNullOrEmpty(companycode))
{
Application.Context.Server.Transfer(AppPath
+
"
/company/Login.aspx
"
);
}
else
{
string
isExistPage
=
CNNet.CommonBLL.EnumBind.GetEnumUrlByURL(url,
typeof
(CNNet.CommonBLL.Dictionary.DEP_Control_Infor));
if
(isExistPage
!=
"
101
"
&&
string
.IsNullOrEmpty(isExistPage))
{
Application.Context.Server.Transfer(AppPath
+
"
/company/message/HttpMessage.aspx
"
);
}
else
if
(isExistPage
==
"
101
"
)
{
}
else
{
if
(CNNet.CommonDAL.DbHelperSQL.GetSingle(
string
.Format(CNNet.CommonBLL.Constants.sql_EP_PowerLinkTo_One, companycode,
"
UserName='
"
+
userCode
+
"
'
"
,
"
PowerCode='
"
+
isExistPage
+
"
'
"
))
==
null
)
{
Application.Context.Server.Transfer(AppPath
+
"
/company/message/HttpQX.aspx
"
);
}
}
}
}
#endregion
#region
分站
if
((url.ToUpper().IndexOf(
"
CENT
"
)
>
0
&&
url.ToUpper().IndexOf(
"
.ASPX
"
)
>
0
)
||
url.ToUpper().IndexOf(
"
Search/pages/sub_index.aspx
"
.ToUpper())
>
0
||
url.ToUpper().IndexOf(
"
search/pages/sub_indexDe.aspx
"
.ToUpper())
>
0
)
{
string
Domain
=
""
;
CNNet.BLL.RejoiceGarden gardenbll
=
new
CNNet.BLL.RejoiceGarden();
Domain
=
Application.Context.Request.Url.Authority;
string
secodedomain
=
String.Empty;
secodedomain
=
Domain.Split(
'
.
'
)[
0
].ToString();
CNNet.CommonBLL.Cookie cookie
=
new
CNNet.CommonBLL.Cookie();
string
gardencodevalue
=
""
;
gardencodevalue
=
CNNet.CommonBLL.ConfigHelper.GetGardenCode();
cookie.delCookie(gardencodevalue);
string
gardencode
=
String.Empty;
try
{
gardencode
=
gardenbll.GetGardenCodeByDomain(secodedomain);
}
catch
{
gardencode
=
"
0
"
;
}
if
(gardencode
==
""
)
{
gardencode
=
"
0
"
;
}
//
本地测试用北京园区编码
if
(gardencode
==
"
0
"
)
gardencode
=
"
11010001
"
;
SetCookie(gardencode);
}
#endregion
}
private
void
SetCookie(
string
gardencode)
{
//
System.Web.HttpCookie cookie = new System.Web.HttpCookie("gxrcgardencode");
//
DateTime dt = DateTime.Now;
//
cookie.Expires = dt.AddMinutes(0);
//
cookie.Value = gardencode;
//
System.Web.HttpContext.Current.Response.AppendCookie(cookie);
System.Web.HttpContext.Current.Response.Cookies[ConfigHelper.GetGardenCode()].Value
=
gardencode;
}
public
void
Dispose()
{
}
}
}
版权说明:
本网站凡注明“广州松河 原创”的皆为本站原创文章,如需转载请注明出处!
本网转载皆注明出处,遵循行业规范,如发现作品内容版权或其它问题的,请与我们联系处理!
欢迎扫描右侧微信二维码与我们联系。
相关主题:
光明新区外贸网站设计
济宁外贸网站服务商
孟州外贸网站的建设
外贸网站域名买哪家好
江门外贸网站推广代理
巴中外贸网站哪家好
外贸网站如何满足客户需求
联雅外贸网站建设价格
绥化外贸网站设计制作
奉化区外贸网站定制
·上一条:
Asp.net Web Applicatoin实现自定义HttpModule拦截异常处理
|
·下一条:
C#使用IHttpModule接口修改http输出的方法
同类资讯
杭州女生学html5难学吗_js/jQuery
小程序属于网页吗_vue
以前搜索过的网页现在怎么能找到_js/jQuery
动态扩展组件是什么_vue
12位AD转换器有哪些_js/jQuery
vue中name和areas的用法_vue
西安动物园门票预约官网_vue
怎么把照片合成小视频_vue
现在做前端是不是一定要会开发小程序啊_vue
录制视频用的什么录音软件_vue
vue中的log是什么意思_vue
iphone11延时摄影怎么调速度_vue
vue是开发语言吗_vue
jquery大小写区别_js/jQuery
vue和flutter哪个值得学习_vue
比如我某个时间要做什么记录下来_js/jQuery
JS插件如何使用_js/jQuery
data对象的属性和方法_vue
如何做地图定位_js/jQuery
什么叫语义库_js/jQuery
资讯动态
公司新闻
互联网资讯
电商资讯
优化推广
技术支持
关于我们
公司简介
企业文化
服务项目
公司新闻
服务项目
网站建设
网站推广
品牌策划
移动应用
服务支持
在线咨询
服务流程
产品报价
售后服务
联系我们
代理加盟
付款方式
在线留言
联系方式
联系方式
电话:400-963-0016
邮箱:sales@itwy.com
QQ:250211130
微信:18520775521
Copyright © 广州松河信息科技有限公司 2005-2025 版权所有
粤ICP备16019765号
广州松河信息科技有限公司 版权所有
18520775521
QQ洽谈
sales@itwy.com