<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    allen
    專注于java ee技術,包括struts,jsf,webwork,spring,hibernate,ibatis
    posts - 7,  comments - 9,  trackbacks - 0

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Xml;
    using System.Net;
    using System.IO;
    namespace ssotest
    {
    ?/// <summary>
    ?/// login 的摘要說明。
    ?/// </summary>
    ?public class login : System.Web.UI.Page
    ?{
    ??protected System.Web.UI.WebControls.Label Label1;
    ??private const string CASHOST = "https://localhost:8443/cas/";
    ??


    ??private void Page_Load(object sender, System.EventArgs e)
    ??{
    ???// 在此處放置用戶代碼以初始化頁面
    ???String tkt=Request.QueryString["ticket"];
    ???string service = Request.Url.GetLeftPart(UriPartial.Path);
    ???if (tkt == null || tkt.Length == 0)
    ???{
    ????string redir = CASHOST + "login?" +???????????????? "service=" + service;
    ????Response.Redirect(redir);
    ????return ;
    ???}
    ???string validateurl = CASHOST + "serviceValidate?" +
    ????"ticket=" + tkt + "&"+
    ????"service=" + service;
    ???//Response.Write(validateurl);
    ???System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
    ???StreamReader Reader = new StreamReader( new WebClient().OpenRead(validateurl));
    ???string resp = Reader.ReadToEnd();
    ???NameTable nt = new NameTable();
    ???XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
    ???XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
    ???XmlTextReader reader = new XmlTextReader(resp, XmlNodeType.Element, context);

    ???string netid = null;
    ???while (reader.Read())
    ???{
    ????if (reader.IsStartElement())
    ????{
    ????? string tag = reader.LocalName;
    ????? if (tag=="user")????????????????
    ?????? netid = reader.ReadString();????????????????
    ????}
    ???}
    ??? reader.Close();
    ???if (netid == null)
    ???{
    ????Label1.Text = "CAS returned to this application, but then refused to validate your identity.";????????
    ???}
    ???else
    ???{
    ????? Label1.Text = "Welcome " + netid;?
    ???? // FormsAuthentication.RedirectFromLoginPage(netid, false);
    ???}
    ??}
    ??public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy

    ??{

    ???public TrustAllCertificatePolicy()

    ???{}

    ?

    ???public bool CheckValidationResult(ServicePoint sp,

    ????System.Security.Cryptography.X509Certificates.X509Certificate cert,

    ????WebRequest req, int problem)

    ???{

    ????return true;

    ???}

    ??}


    ??#region Web 窗體設計器生成的代碼
    ??override protected void OnInit(EventArgs e)
    ??{
    ???//
    ???// CODEGEN: 該調用是 ASP.NET Web 窗體設計器所必需的。
    ???//
    ???InitializeComponent();
    ???base.OnInit(e);
    ??}
    ??
    ??/// <summary>
    ??/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
    ??/// 此方法的內容。
    ??/// </summary>
    ??private void InitializeComponent()
    ??{???
    ???this.Load += new System.EventHandler(this.Page_Load);

    ??}
    ??#endregion
    ?}
    }

    posted on 2006-11-09 11:51 robbin163 閱讀(1383) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(3)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲第一永久在线观看| 亚洲国产AV无码专区亚洲AV| 亚洲午夜精品国产电影在线观看| 久久美女网站免费| 久久亚洲AV午夜福利精品一区| 国产精品偷伦视频观看免费| 亚洲AV无码乱码在线观看富二代| 免费观看91视频| 亚洲美女色在线欧洲美女| 亚洲黄色免费观看| 亚洲天堂2016| 国产成人一区二区三区免费视频 | 免费毛片毛片网址| 伊人久久亚洲综合影院| www永久免费视频| 久久精品亚洲综合| 亚洲免费二区三区| 亚洲精品一二三区| 免费国产高清视频| 大地资源在线资源免费观看| 亚洲精品自拍视频| 免费视频淫片aa毛片| 免费人成大片在线观看播放电影| 中文字幕精品亚洲无线码一区| 久久久免费的精品| 亚洲综合激情五月色一区| 国产又大又长又粗又硬的免费视频| 中美日韩在线网免费毛片视频 | 久久精品国产精品亚洲精品| 亚洲免费人成视频观看| 亚洲aⅴ天堂av天堂无码麻豆 | 亚洲一区二区在线视频| 欧美日韩国产免费一区二区三区| 特级一级毛片免费看| 久久久久久亚洲精品| 天天看免费高清影视| 国产福利电影一区二区三区,免费久久久久久久精 | 亚洲黄色在线播放| 日产乱码一卡二卡三免费| 美女巨胸喷奶水视频www免费| 亚洲国产日韩在线成人蜜芽|