/// <summary> /// 重写OnLoad的事件 /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { if (Session["Token"] != null) { //分站凭证存在 Response.Write("恭喜,分站凭证存在,您被授权访问该页面!"); } else { //令牌验证结果 if (Request.QueryString["Token"] != null) { if (Request.QueryString["Token"] != "$Token$") { //持有令牌 string tokenValue = Request.QueryString["Token"]; //调用WebService获取主站凭证 SiteA.TokenService.TokenService tokenService = new SiteA.TokenService.TokenService(); SiteA.TokenService.MySoapHeader header = new SiteA.TokenService.MySoapHeader(); header.UserID = "admin"; header.PassWord = "******"; tokenService.MySoapHeaderValue = header; object o = tokenService.TokenGetCredence(tokenValue); if (o != null) { //令牌正确 Session["Token"] = o; Response.Write("恭喜,令牌存在,您被授权访问该页面!"); } else { //令牌错误 Response.Redirect(this.ReplaceToken()); } } else { //未持有令牌 Response.Redirect(this.ReplaceToken()); } } //未进行令牌验证,去主站验证 else { Response.Redirect(this.getTokenURL()); } } base.OnLoad(e); }
/// <summary> /// 重写OnLoad的事件 /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { if (Session["Token"] != null) { //分站凭证存在 Response.Write("恭喜,分站凭证存在,您被授权访问该页面!"); } else { //令牌验证结果 if (Request.QueryString["Token"] != null) { if (Request.QueryString["Token"] != "$Token$") { //持有令牌 string tokenValue = Request.QueryString["Token"]; //调用WebService获取主站凭证 SiteA.TokenService.TokenService tokenService = new SiteA.TokenService.TokenService(); SiteA.TokenService.MySoapHeader header = new SiteA.TokenService.MySoapHeader(); header.UserID = "admin"; header.PassWord = "******"; tokenService.MySoapHeaderValue = header; object o = tokenService.TokenGetCredence(tokenValue); if (o != null) { //令牌正确 Session["Token"] = o; Response.Write("恭喜,令牌存在,您被授权访问该页面!"); } else { //令牌错误 Response.Redirect(this.ReplaceToken()); } } else { //未持有令牌 Response.Redirect(this.ReplaceToken()); } } //未进行令牌验证,去主站验证 else { Response.Redirect(this.getTokenURL()); } } base.OnLoad(e); }