首页 > 代码库 > sharepoint 2013 如何登陆AD认证的sharepoint站点

sharepoint 2013 如何登陆AD认证的sharepoint站点

记录一下如何登陆AD认证的sharepoint站点,通过一个脚本可以实现。

<scripttype="text/javascript">

   varxmlHttp;

   varloginUrl;

   functioncreateXMLHttpRequest()

   {

       loginUrl ="http://moss.com/";

       if(window.ActiveXObject) {

           xmlHttp =newActiveXObject("Microsoft.XMLHTTP");

       }

       else{

           xmlHttp =newXMLHttpRequest();

       }

   }

   functionstartRequest(UserID, Psw)

   {

       createXMLHttpRequest();

       xmlHttp.onreadystatechange = handleStateChange;

       xmlHttp.open("GET", loginUrl,true, UserID, Psw);

       xmlHttp.send(null);

   }

   functionhandleStateChange()

   {

       if(xmlHttp.readyState == 4)

       {

           if(xmlHttp.status == 200)

           {

               window.location = loginUrl;

           }

           else{

               alert("登录失败,请使用IE浏览器访问!");

           }

       }

   }

</script>

调用的方法如下:

<inputtype="submit"name="Submit"value="提交"onclick="javascript: startRequest(‘domain\\userid‘,‘password‘);">

 

还需要把当前站点,添加为可信任站点。