try it:
string strSearch = "search keyword";
string strUrl = "http://site.search.sohu.com/website.jsp?key_word=" + strSearch + "&page_index=0";
Server.Transfer(strUrl);

解决方案 »

  1.   

    System.Net.WebClient wc=new System.Net.WebClient;
    string url="";
    String aa= Encoding.ASCII.GetString(wc.DownloadData(url));
                   
      

  2.   

    to ETstudio:
    你给的代码,返回的aa不能返回图片和控件,只是字符吗?而且原来的超连接也没有了.怎么办?
    to JoeM:
    我用您的代码时总是抱错,说需要虚拟路径,我给的是啊.而且是本机的路径,应该没有错的.问题出在哪儿呢?
    谢谢两位的帮忙!!!
      

  3.   

    write a vbscript to test it
    eg:Option Explicit
    Dim fEnableDelays
    fEnableDelays = FalseSub SendRequest1()
        Dim oConnection, oRequest, oResponse, oHeaders, strStatusCode
        If fEnableDelays = True then Test.Sleep (0)
        Set oConnection = Test.CreateConnection("localhost", 80, false)
        If (oConnection is Nothing) Then
            Test.Trace "Error: Unable to create connection to localhost"
        Else
            Set oRequest = Test.CreateRequest
            oRequest.Path = "/log/WebForm1.aspx"
            oRequest.Verb = "GET"
            oRequest.HTTPVersion = "HTTP/1.0"
            set oHeaders = oRequest.Headers
            oHeaders.RemoveAll
            oHeaders.Add "Accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
            oHeaders.Add "Accept-Language", "zh-cn"
            'oHeaders.Add "Cookie", "AspNetWebAuth=727B36DDE70BABB20148006F006C0079004A006F0065000000FCE2B8E9DF33C30101FC22E9A70043FB0100002F000000"
            oHeaders.Add "Cookie", "(automatic)"
            oHeaders.Add "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
            'oHeaders.Add "Host", "localhost"
            oHeaders.Add "Host", "(automatic)"
            oHeaders.Add "Cookie", "(automatic)"
            Set oResponse = oConnection.Send(oRequest)
            If (oResponse is Nothing) Then
                Test.Trace "Error: Failed to receive response for URL to " + "/log/WebForm1.aspx"
            Else
                strStatusCode = oResponse.ResultCode
            End If
            oConnection.Close
        End If
    End SubSub SendRequest2()
        Dim oConnection, oRequest, oResponse, oHeaders, strStatusCode
        If fEnableDelays = True then Test.Sleep (31)
        Set oConnection = Test.CreateConnection("localhost", 80, false)
        If (oConnection is Nothing) Then
            Test.Trace "Error: Unable to create connection to localhost"
        Else
            Set oRequest = Test.CreateRequest
            oRequest.Path = "/aspnet_client/system_web/1_1_4322/WebUIValidation.js"
            oRequest.Verb = "GET"
            oRequest.HTTPVersion = "HTTP/1.0"
            set oHeaders = oRequest.Headers
            oHeaders.RemoveAll
            oHeaders.Add "Accept", "*/*"
            oHeaders.Add "Referer", "http://localhost/log/WebForm1.aspx"
            oHeaders.Add "Accept-Language", "zh-cn"
            oHeaders.Add "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)"
            'oHeaders.Add "Host", "localhost"
            oHeaders.Add "Host", "(automatic)"
            'oHeaders.Add "Cookie", "AspNetWebAuth=727B36DDE70BABB20148006F006C0079004A006F0065000000FCE2B8E9DF33C30101FC22E9A70043FB0100002F000000; ASP.NET_SessionId=rgfvfn55rufypg55qvzin2vv"
            oHeaders.Add "Cookie", "(automatic)"
            Set oResponse = oConnection.Send(oRequest)
            If (oResponse is Nothing) Then
                Test.Trace "Error: Failed to receive response for URL to " + "/aspnet_client/system_web/1_1_4322/WebUIValidation.js"
            Else
                strStatusCode = oResponse.ResultCode
            End If
            oConnection.Close
        End If
    End Sub
    Sub Main()
        call SendRequest1()
        call SendRequest2()
    End Sub
    Main