钉钉免登asp版

网上的版本很多,带就是没有asp版

前端

var access_token=""
var CorpId="***********"
var xmlhttp;
if (window.XMLHttpRequest)
{
// IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
xmlhttp=new XMLHttpRequest();
}
else
{
// IE6, IE5 浏览器执行代码
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}

function token(code)
{

xmlhttp.onreadystatechange=function()
{
	if (xmlhttp.readyState==4 && xmlhttp.status==200)
	{
		
		access_token=xmlhttp.responseText;

//var bb=JSON.parse(access_token)

	//access_token=bb.access_token//
	document.getElementById("myDiv0").innerHTML=access_token
	//loadXMLDoc(access_token)
	}
}
xmlhttp.open("GET","/dd/dd.asp?code="+code,true);
xmlhttp.send();

}
/*
function loadXMLDoc(access_t)
{

xmlhttp.onreadystatechange=function()
{
	if (xmlhttp.readyState==4 && xmlhttp.status==200)
	{
		
		bb=xmlhttp.responseText;

//var bb=JSON.parse(access_token)
document.getElementById(“myDiv”).innerHTML=bb//
}
}
xmlhttp.open(“GET”,"/dd/dd.asp?token="+access_t,true);
xmlhttp.send();
}*/

后端

<%
Response.Addheader “Content-Type”,“text/html;charset=gb2312”

code=request.querystring(“code”)

Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject(“adodb.stream”)
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

function getHTTPPage(url)
dim Http
set Http=server.createobject(“MSXML2.XMLHTTP”)
Http.open “GET”,url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
'getHTTPPage=Http.responseBody19f538914891314bac7c7a0008e3ea49
getHTTPPage=bytesToBSTR(Http.responseBody,“UTF-8”)
set http=nothing
if err.number<>0 then err.Clear
end function

appkey="//"
appsecret=""
url0=“https://oapi.dingtalk.com/gettoken?appkey=”&appkey&"&appsecret="&appsecret

Dim access
Dim json

'asp解溪json
Dim sc4Json,arr0
InitScriptControl

json = getHTTPPage(url0)
Set jsonobj=getJSONObject(json)

access_token =sc4Json.Eval(“jsonObject.access_token”)

url1=“https://oapi.dingtalk.com/user/getuserinfo?access_token=”&access_token&"&code="&code
json = getHTTPPage(url1)

%>

<%=json%>

<%
'asp解溪json

Sub InitScriptControl
Set sc4Json = Server.CreateObject(“MSScriptControl.ScriptControl”)
sc4Json.Language = “JavaScript”
sc4Json.AddCode “var itemTemp=null;function getJSArray(arr, index){itemTemp=arr[index];}”
End Sub

Function getJSONObject( strJSON )
sc4Json.AddCode "var jsonObject = " & strJSON
Set getJSONObject = sc4Json.CodeObject.jsonObject
End Function

%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值