云星空登录index.aspx页面自动转向统一认证页面

云星空登录index.aspx页面自动转向统一认证页面
【推荐私有云和单租户使用,不支持多租户】
1、编写iis的处理程序Html5IndexAspxHttpModule ,新建类库工程 TXSLoginModule,引用System.Web组件,编写 如下demo。
(注意编译dll后,拷贝到WebSite/Bin下,然后配置web.config, 然后重启iis站点)
(重现贴下代码,总有人有问题 (-:<:))
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
namespace TXSLoginModule
{
public class Html5IndexAspxHttpModule : System.Web.IHttpModule
{
public void Init(HttpApplication context)
{
// Demo代码不做错误保护,请在业务代码中做好错误保护和日志处理
context.BeginRequest += context_BeginRequest;
}
void context_BeginRequest(object sender, EventArgs e)
{
// Demo代码不做错误保护,请在业务代码中做好错误保护和日志处理
var ctx = sender as HttpApplication;
if (ctx != null)
{
if (ctx.Request.Url.AbsolutePath.ToLowerInvariant().Contains("html5/index.aspx") &&
string.IsNullOrWhiteSpace(ctx.Request.QueryString.Get("ud")))
{
// 这里转向统一认证界面地址 ,
// website/html5目录下编写singlelogin.html和连接实现统一认证模拟,
// 正式登出地址请咨询第三方sso供应商
// 参考下面 3的内容
var rurl = System.Web.VirtualPathUtility.Combine(ctx.Request.Url.AbsolutePath, "singlelogin.html"); //singlelogin.html 为模拟sso登陆地址,具体请按真实登出地址修改。
// 应用程序池集成模式
ctx.Response.Redirect(rurl);
// 应用程序池经典模式
//ctx.Server.Transfer(rurl);
}
}
}
public void Dispose()
{
}
}
}
2、在WebSite目录下的Web.Config的modules节点下增加处理程序,如下:
(配置后,需要重启站点)
2.1、 应用程序池经典模式 web.config,写在system.web/httpModules节点下
<system.web>
云星空登录index.aspx页面自动转向统一认证页面
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。



