Topic: Cas sso中asp,asp.net客户端问题 |
Print this page |
1.Cas sso中asp,asp.net客户端问题 | Copy to clipboard |
Posted by: zhoujunsheng168 Posted on: 2006-11-08 11:05 我在使用asp.net,在Cas Server端认证后不能返回到原来的aspx文件,老是出现:即将定向不安全的连接,你正在发送到当前站点的信息可能重新传送到不安全的站点,是否继续? 点击是后,却也不能发送到原来的站点,出现一样的对话框?请问是什么原因? asp.net程序: http://localhost/ssotest/WebForm1.aspx 当打开这个后自动定位到: https://localhost:8443/cas/login?service=http://localhost/ssotest/WebForm1.aspx 验证后去不能返回到原来的aspx. 程序代码如下:CASP.cs public class CASP { public CASP() { // // TODO: 在此处添加构造函数逻辑 // } public static String Authenticate( String LoginURL, String ValidateURL, Page Page ) { return Authenticate( LoginURL, ValidateURL, Page, Page.Request.Url.AbsoluteUri.Split('?')[0] ) ; } public static String Authenticate( String LoginURL, String ValidateURL, Page Page, String ServiceURL ) { if( Page.Session["CASNetworkID"] != null ) // user already logged in return Page.Session["CASNetworkID"].ToString() ; else // user hasn't logged in { if( Page.Request.QueryString["ticket"] != null ) // ticket received { try // read ticket and request validation { StreamReader Reader = new StreamReader( new WebClient().OpenRead( ValidateURL + "?ticket=" + Page.Request.QueryString["ticket"] + "&service=" + ServiceURL ) ) ; if( "yes".Equals( Reader.ReadLine() ) ) // ticket validated { // store network id in sesssion, return value return (String) ( Page.Session["CASNetworkID"] = Reader.ReadLine() ) ; } } catch( WebException ) {} } // ticket was invalid, or didn't exist, so request ticket Page.Response.Redirect( LoginURL + "?service=" + ServiceURL, true ) ; return null ; } } } 在WebForm1.PageLoad事件中调用: String NetworkID = CASP.Authenticate( "https://localhost:8443/cas/login", "https://localhost:8443/cas/proxyValidate", this ) ; 把https://localhost:8443/cas/Proxyvalidate改为https://localhost:8443/cas/validate也不行? 请问是什么原因? 另外我使用CAS Client自己带的asp的例子,输入http://localhost/test/cas.asp后,自动转到cas server验证,验证通过后,回到http://localhost/test/HelloCas/default.asp,但我想得到用户信息?却总是空,不知道是怎么回事? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |