以前做的只是使用Moss的单一登录,用Moss去登录其他的系统,现在要反过来,用Form认证的系统来登录Moss?
最后发现了一个比较简单的办法,用AJAX,哈哈就是这个,不多说了,直接贴代码吧!
Code
1function InitAjax()
2 {
3 var ajax=false;
4 try
5 {
6 ajax = new ActiveXObject("Msxml2.XMLHTTP");
7 }
8 catch (e)
9 {
10 try
11 {
12 ajax = new ActiveXObject("Microsoft.XMLHTTP");
13 }
14 catch (E)
15 {
16 ajax = false;
17 }
18 }
19
20 if (!ajax && typeof XMLHttpRequest!='undefined')
21 {
22 ajax = new XMLHttpRequest();
23 }
24 return ajax;
25 }
26
27 function Login()
28 {
29 try
30 {
31 var strName ='aw.com\\sales';
32 var strPWD = 'pass@word1';
33 var location = 'http://moss:2000';
34 var ajax = new InitAjax();
35
36 ajax.open('post',location,false,strName,strPWD);
37 ajax.send();
38 if ( ajax.status == 200 )
39 {
40 window.location.href =location;
41 }
42
43 }
44 catch(e)
45 {}
46 }
1function InitAjax()
2 {
3 var ajax=false;
4 try
5 {
6 ajax = new ActiveXObject("Msxml2.XMLHTTP");
7 }
8 catch (e)
9 {
10 try
11 {
12 ajax = new ActiveXObject("Microsoft.XMLHTTP");
13 }
14 catch (E)
15 {
16 ajax = false;
17 }
18 }
19
20 if (!ajax && typeof XMLHttpRequest!='undefined')
21 {
22 ajax = new XMLHttpRequest();
23 }
24 return ajax;
25 }
26
27 function Login()
28 {
29 try
30 {
31 var strName ='aw.com\\sales';
32 var strPWD = 'pass@word1';
33 var location = 'http://moss:2000';
34 var ajax = new InitAjax();
35
36 ajax.open('post',location,false,strName,strPWD);
37 ajax.send();
38 if ( ajax.status == 200 )
39 {
40 window.location.href =location;
41 }
42
43 }
44 catch(e)
45 {}
46 }