您的位置:首页 > 移动开发

EIAC.SSO接入接口文档

2014-01-08 11:31 183 查看


protected void Page_Load(object sender, EventArgs e)
{
//Session.Abandon()就是把当前Session对象删除了,下一次就是新的Session了。
Session.Abandon();
// 在此处放置用户代码以初始化页面,在页面第一次访问时定位到EAC去认证
if (!IsPostBack)
{
if (Request["IASID"]== null)
{
if (AppSSOBLL.TOEACAuthenticat(InterfaceUtility.GetIASID(), AppSSOBLL.GetTimeStamp(), Request.Url.AbsoluteUri,""))
{
//todo
}
}
//接受EAC发送回来的认证信息,如果通过定位到保护页面
if (Request["IASID"] != null)
{
if (Request["Result"].ToString() == "0")
{
if (AppSSOBLL.ValidateFromEAC(Request["IASID"].ToString(), Request["TimeStamp"].ToString(),Request["UserAccount"].ToString(), Request["Result"].ToString(), Request["ErrorDescription"].ToString(),Request["Authenticator"].ToString()))
{
//为提供的用户名创建一个身份验证票证,并将其添加到响应的 Cookie 集合或 URL。
FormsAuthentication.SetAuthCookie(Request["UserAccount"], false);
FormsAuthentication.RedirectFromLoginPage(Request["UserAccount"], false);
}
}
}
}
}


小注:FormsAuthentication.RedirectFromLoginPage.这个方法接收的参数是用户名或者其它的一些身份信息.在Asp.net中登录用户的状态是持久化存储在客户端的cookie中.当你调用RedirectFromLoginPage时就会创建一个包含加密令牌FormsAuthenticationTicket的cookie,cookie名就是登录用户的用户名   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息