专业网站建设品牌,18年专业建站经验,服务6000+客户--广州松河
免费热线:400-963-0016
微信咨询
|
联系我们
扫二维码关注公众号
网站首页
网站建设
短视频
网站推广
网站模板
客户案例
资讯动态
关于我们
网站首页
网站建设
短视频
网站推广
网站模板
客户案例
资讯动态
关于我们
位置:
广州松河
>
技术支持
> httpModule控制url跳转
httpModule控制url跳转
来源:网络整理 时间:2023/2/14 0:51:31 共
3668
浏览
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输出的方法
同类资讯
web端开发需要什么_vue
phigros玩法介绍_vue
低血糖的人该怎么减肥_CSS学习
写出一个三行三列表格的html代码且第一行设置为标题单元格_CSS学习
小米12s相机有没有智慧视觉_vue
什么时候用分节符和分页符_vue
为什么wifi按键总是自动跳掉_vue
html表格插入图片怎么顶格_CSS学习
浏览器滑动条不能动_vue
盐城市社保信息查询_CSS学习
html怎么让标题空两格_CSS学习
form1窗口放大找不到边界了怎么回事_CSS学习
企业信息填报怎么登录_CSS学习
cs4一打开桌面为什么就会多出Clean_vue
如何在一张照片都局部做出方框性标志_CSS学习
颂拓suunto拓野3语言设置错误了怎么调回来_vue
乔丹衣服标志在右边是正品吗_CSS学习
wifi加密类型aes属于哪种等级_vue
EXCEL2010数据里的现有连接如何操作_CSS学习
vue可以放多段音乐吗_vue
资讯动态
公司新闻
互联网资讯
电商资讯
优化推广
技术支持
关于我们
公司简介
企业文化
服务项目
公司新闻
服务项目
网站建设
网站推广
品牌策划
移动应用
服务支持
在线咨询
服务流程
产品报价
售后服务
联系我们
代理加盟
付款方式
在线留言
联系方式
联系方式
电话:400-963-0016
邮箱:sales@itwy.com
QQ:250211130
微信:18520775521
Copyright © 广州松河信息科技有限公司 2005-2026 版权所有
粤ICP备16019765号
广州松河信息科技有限公司 版权所有
18520775521
QQ洽谈
sales@itwy.com