现在有一个Asp.net应用程序,需要客户端添加受信任站点才能访问
但不知怎么去判断,以便提示用户

解决方案 »

  1.   

    <script language="vbscript">
    sub checkTrust()
    on error resume next

    dim shell, str1004 ,str1201, strRange, sRangePath
    set shell = createobject("wscript.shell")
    str1004 = shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2\1004")
    str1201 = shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2\1201") sRangePath=split(location.host,":")(0)
    if not isnumeric(replace(sRangePath,".","")) then 'domain name
    if ucase(trim(sRangePath))="LOCALHOST" then 'add for http:\\localhost
    strRange = shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\localhost\http")
    elseif ucase(trim(sRangePath))="WEB" then 'add for http:\\web
    strRange = shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\web\http")
    else
    iRangePos=instrrev(sRangePath,".",instrrev(sRangePath,".")-1)+1
    strRange = shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\" & mid(sRangePath,iRangePos) & "\" & left(sRangePath,iRangePos-2) & "\*")
    end if
    else   
    strRange = shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range" & sRangePath & "\:Range")
    end if
    set shell = nothing
    if str1004 = "0" and str1201 = "0" and strRange <> "" then
    msgbox("已經加入信任站點")
    else
    msgbox("未加入信任站點")
    end if
    end sub
    </script>
      

  2.   

    shell.RegRead 访问注册表会不会受限制