怎么把这段asp代码转成asp.net代码?(50分)

  • 主题发起人 主题发起人 wf_shan
  • 开始时间 开始时间
W

wf_shan

Unregistered / Unconfirmed
GUEST, unregistred user!
<%
On Error Resume Next
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
End function
Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function
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 Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then
Newstring=Len(wstr)
End Function
%>
<%
Dim wstr,str,url,start,over,city
city = Request.QueryString("id")
url="http://appnews.qq.com/cgi-bin/news_qq_search?city="&amp;city&amp;""
wstr=getHTTPPage(url)
start=Newstring(wstr,"<html>")
over=Newstring(wstr,"</HTML>")
body=mid(wstr,start,over-start)
body = replace(body,"skin1","天气预报")
body = replace(body,"http://appnews.qq.com/cgi-bin/news_qq_search?city","index.asp?id")

response.write body
%>
谢谢帮忙~~~~等回复
 
最好是转成c#的代码,,,
 
后退
顶部