在网上搜了下,有PHP的,有ASP的,就是没有.NET的~
我想在自己的网页上加入sogou Rank和google Rank显示功能
哪位大大知道他们的值是怎么获取的,
代码怎么写~不胜感激~

解决方案 »

  1.   

    有asp的, 我觉的看一看就可以搬到asp.net上了
      

  2.   

    <%
    Dim sogouStr,r,sogoup
    Function GetPage(url) 
    dim SendData,Retrieval
            Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
            With Retrieval 
            .Open "post", url, False
            .setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
            .setRequestHeader "User-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)"         
            .Send()
            GetPage = BytesToBstr(.ResponseBody)
            End With 
            Set Retrieval = Nothing 
    End Function
    Function BytesToBstr(body)
            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 = "GB2312"
            BytesToBstr = objstream.ReadText 
            objstream.Close
            set objstream = nothing
    End Function
    Function GetContent(str,start,last,n)
            If Instr(lcase(str),lcase(start))>0 then
                    select case n
                    case 0        '左右都截取(都取前面)(去处关键字)
                    GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1) 
                    GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))-1)
                    case 1        '左右都截取(都取前面)(保留关键字)
                    GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
                    GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))+Len(last)-1)
                    case 2        '只往右截取(取前面的)(去除关键字)
                    GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
                    end select
            Else
                    GetContent=""
            End if
    End functionr=request("r")
    if r="" then r="此处换成你的blog地址"
    sogoustr=GetPage("sogou.com/web?query=" target="_blank">http://www.sogou.com/web?query="&r)
    sogoup=GetContent(sogoustr,"<img src=""/images/pr.gif"" width=""","%""",0)
    response.Write "document.write(""<div style='font: 11px/11px Arial, Helvetica, sans-serif;color: #137258;"
    response.Write "height: 14px;margin-top: 4px;'>"
    response.Write "<div style='float: left;margin-right: 3px;'>Sogou Rank</div>"
    response.Write "<span style='overflow-y:hidden;width: 65px;height: 7px;_width /**/: 69px;_height /**/: 11px;"
    response.Write "padding: 2px;float: left;background: url(/prbar.gif) no-repeat left;'>"
    response.Write "<img src='/pr.gif' width="&sogoup&"% height=7/></span>"&sogoup&"</div>"")"
    set sogouStr=nothing
    set sogoup=nothing
    set r=nothing
    %>这是网上一个读取sogou Rank的代码,不知哪个大大可以完善一下`
    好像是ASP的吧,改成c#是最好
      

  3.   

    http://www.goocn.cn/article.asp?id=124
      

  4.   

    上楼的,是ASP的代码,我要的是ASP.NET的!
    最近自己参考了一些资料,实现了用ASP.NET获取SOGOU RANK,
    大家可以去我的个人博客查:www.fmiss.com
    或在本人在CDSN的博客上也有!