专业网站建设品牌,十四年专业建站经验,服务6000+客户--广州京杭网络
免费热线:400-963-0016
微信咨询
|
联系我们
扫二维码关注公众号
网站首页
网站建设
短视频
网站推广
网站模板
客户案例
资讯动态
关于我们
网站首页
网站建设
短视频
网站推广
网站模板
客户案例
资讯动态
关于我们
位置:
网站建设
>
技术支持
> httpModule控制url跳转
httpModule控制url跳转
来源:网络整理 时间:2023/2/14 0:51:31 共
3647
浏览
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()
{
}
}
}
版权说明:
本网站凡注明“广州京杭 原创”的皆为本站原创文章,如需转载请注明出处!
本网转载皆注明出处,遵循行业规范,如发现作品内容版权或其它问题的,请与我们联系处理!
欢迎扫描右侧微信二维码与我们联系。
相关主题:
阳泉建外贸网站
余姚外贸网站制作
外贸网站建造流程
汨罗外贸网站建设
南昌外贸网站优化
桥头外贸网站制作
芯片外贸网站推荐
外贸网站源码静态
外外贸网站seo
外贸网站好处
·上一条:
Asp.net Web Applicatoin实现自定义HttpModule拦截异常处理
|
·下一条:
C#使用IHttpModule接口修改http输出的方法
同类资讯
Asp.net Web Applicatoin实现自定义HttpModu
如何使用 GroupBy 方法通过使用基于方法的查询语法来查询-分组
Fiddler抓包工具总结
C#调用RabbitMQ实现消息队列
C#使用RabbitMQ
windows配置Erlang环境
C#实现对站点、程序池状态的监控,以及URL能正常返回的监控,状态异常,
使用C#开发IIS模块后门
IIS中 .NET Web Api后台接口监控解决方案
编写自己的HttpModule
ASP.NET之HttpModule拦截404异常
什么是流程图?
主流分布式存储技术的对比分析与应用
linq如何使用 Select 和 SelectMany 方法通过基于方
如何使用 Where 和 Where…Contains 方法通过基于方法
如何使用 ThenBy 方法通过使用基于方法的查询语法来查询-中间件排序
如何使用 Aggregate 、 Average、Count 、 Lon
如何使用 Skip 和 Take 方法通过使用查询表达式语法来查询-分区
如何使用 ToArray ToDictionary 和 ToList 方
如何使用 Join 和 GroupJoin 方法通过基于方法的查询语法来
资讯动态
公司新闻
互联网资讯
电商资讯
优化推广
技术支持
关于我们
公司简介
企业文化
服务项目
公司新闻
服务项目
网站建设
网站推广
品牌策划
移动应用
服务支持
在线咨询
服务流程
产品报价
售后服务
联系我们
代理加盟
付款方式
在线留言
联系方式
联系方式
电话:400-963-0016
邮箱:sales@itwy.com
QQ:250211130
微信:18520775521
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有
粤ICP备16019765号
广州京杭网络科技有限公司 版权所有
18520775521
QQ洽谈
sales@itwy.com