CAS 单点登录,通过ticket 获取登录用户
string url =SSOValidate+"?service=" + WebValidate + "&ticket=" + Ticket + "&pgtUrl" + WebValidate + "?proxyResponse=true"; string clearPassResponse = Utils.GetHttpWebResponse(url, "", Encoding.UTF8);//POST获取返回 登陆用户信息 using (TextReader stringReader = new StringReader(clearPassResponse)) { XmlReaderSettings xmlReaderSetting = new XmlReaderSettings(); xmlReaderSetting.ConformanceLevel = ConformanceLevel.Auto; xmlReaderSetting.IgnoreWhitespace = true; using (XmlReader xmlReader = XmlReader.Create(stringReader, xmlReaderSetting)) { if (xmlReader.ReadToFollowing("cas:username")) { string username = xmlReader.ReadElementString(); if (String.IsNullOrEmpty(username)) { throw new HttpException("登陆失败!"); } LoginUtil.SetLogin(username); } } }