JS认证Exchange

 function ExchangeLogin() {
        vstrServer='<%=LocationUrl %>'
        vstrDomain = '<%=userLogin.AD %>'
        vstrUsername = document.getElementById("<%=UserNameTxt.ClientID%>").value;
        vstrPassword = document.getElementById("<%=PassWordTxt.ClientID%>").value;
        if (vstrUsername == "" || vstrPassword == "")
        { alert("用户名密码不能为空!"); return; }
        var strUrl = "https://" + vstrServer + "/owa/auth/owaauth.dll";
        var strExchange = { destination: 'https://' + vstrServer + '/owa',
            flags: '0', forcedownlevel: '0',
            trusted: '0', isutf8: '1', username: vstrUsername, password: vstrPassword
        };

        var myForm = document.createElement("form");
        myForm.method = "post";
        myForm.action = strUrl;

        for (var varElement in strExchange) {

            var myInput = document.createElement("input");
            myInput.setAttribute("name", varElement);
            myInput.setAttribute("value", strExchange[varElement]);
            myForm.appendChild(myInput);
        }

        document.body.appendChild(myForm);
        myForm.submit();
        document.body.removeChild(myForm);
    }

  

posted @ 2013-08-13 14:36  学途  阅读(513)  评论(0编辑  收藏  举报