这个问题困扰了我很久,网上也没什么答案.
在html网页中很容易实现像类似hao123网中那样的多邮箱登陆和百度搜索条,但是在aspx(c#)网页中很难实现.因为在涉及到JavaScript在aspx页面中的调用.
在aspx页面中使用百度搜索条时,搜索结果是乱码或者是繁体字,不知道什么原因,现在毕业设计要用到这两项功能,请各路高手亮出你的绝招~~~!
最好能给我一段能运行的代码,谢谢啦~!
出好主意的也给高分~!

解决方案 »

  1.   

    百度搜索条在页面中嵌入一段代码就行了嘛!!
    Javascript与aspx的相互调用可以参考我的blog
    cnblogs.com/tengs2000
      

  2.   

      
      百度的编码是gb2312而web.config里的默认编码是   
      <globalization     
                requestEncoding="utf-8"     
                responseEncoding="utf-8"     
      />   
        
      后台代码为即直接讲页面编码变为gb2312:   
      private   void   InitializeComponent()   
      {         
      this.Init+=new   EventHandler(baidu_Init)   
      }   
        
        
      private   void   baidu_Init(object   sender,System.EventArgs   e)   
      {   
            Response.ContentEncoding   =   System.Text.Encoding.GetEncoding("GB2312");   
      }   
      

  3.   

    我是这样做的   
      建了个新页面   
      在前台代码中:   
      <body   MS_POSITIONING="GridLayout">   
            <form   id="Form1"   method="post"   runat="server"   target="result">   
                <FONT   face="宋体"></FONT>   
                    <TBODY>   
        <tr>   
            <td>   
                              <asp:TextBox   ID="text1"   Runat="server"   Width="95px"   Height="22"></asp:TextBox>   
            <asp:Button   ID="btn"   Text="百度搜索"   Runat="server"   Width="72px"   Height="24"></asp:Button>   
            </td>   
                          </tr>   
                    </form>   
      </body>   
      后台的代码即Button的Click事件为:   
      private   void   btn_Click(object   sender,   System.EventArgs   e)   
      {   
              Response.Redirect("http://www.baidu.com/s?wd="+text1.Text+"&cl=3");   
      }   
      

  4.   

      百度的:
           <table width="468" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center">
    <tr> 
    <td><table width=468 height="45" border=0 cellpadding=0 cellspacing=0 bgcolor="f7f7f7">
    <form action=http://www1.baidu.com/baidu target=_blank>
    <tbody>
    <tr> 
    <td width="30%" rowspan="2"> <div align=center><a href="http://www.baidu.com/index.php?tn=sitesowang" target=_blank> 
    <img alt=百度中文搜索引擎 border=0 src="http://img.baidu.com/images/ss_logo.gif"></a></div></td>
    <td valign=bottom width="70%"> <div align=center> 
    <table align=right border=0 cellpadding=0 cellspacing=0 width="100%">
    <tbody>
    <tr> 
    <td><font color="#666666" style="FONT-SIZE: 12px">全球最大的中文信息库,一定有你想要的...</font><font color="#666666" style="FONT-SIZE: 12px"> </font><A                
                            href="http://union.baidu.com/paihang/index.php" 
                            target=_blank><font style="font-size: 12px" color="#ff0000">网站排行榜</font></A></td>
    </tr>
    </tbody>
    </table>
    </div></td>
    </tr>
    <tr> 
    <td valign=bottom><font style="FONT-SIZE: 12px"> 
    <input id=word name=word size="38" value="请输入关键字"  onMouseOver="this.focus()" onBlur="if (value ==''){value='请输入关键字'}" onFocus="this.select()" onClick="if(this.value=='请输入关键字')this.value=''">
    </font> <input align=middle border=0 height=17 id=image name=image src="http://img.baidu.com/img/go.gif" type=image width=30>
    <font style="FONT-SIZE: 12px"> <a href="http://union.baidu.com/paihang/index.php" target=_blank></a><a href="http://union.baidu.com/paihang/index.php" target=_blank></a>
    <input id=tn name=tn type=hidden value=sitesowang>
    </font></td>
    </tr>
    </form>
    </table></td>
    </tr>
    </table><img src= http://un.baidu.com/images/st.gif?tn=sitesowang width=0 height=0>
    2.      google的:
                <center>
    <FORM method=GET action="http://www.google.com/search" target="_blank">
    <TABLE bgcolor="#FFFFFF" style="border:1px solid #000000"><tr><td>
    <A HREF="http://www.google.com/intl/zh-CN/" target="_blank">
    <IMG SRC="http://www.google.com/logos/Logo_40wht.gif" 
    border="0" ALT="Google" align="absmiddle"></A>
    <INPUT TYPE=text name=q size=31 maxlength=255 value="">
    <INPUT TYPE=hidden name=hl  value=zh-CN>
    <INPUT type=submit name=btnG  value="Google搜索">
    </td></tr></TABLE>
    </FORM>
    </center>
      

  5.   

    我在web.config里没有看到  <globalization    
                requestEncoding="utf-8"    
                responseEncoding="utf-8"    />
      
          
    我用的是VS2005+Ajax;
    是什么问题呢?
      

  6.   

    你的是UTF-8页面对吧?那么提交给Baidu搜索的参数就会是UTF-8的,而Baidu本身默认是GBK的,因此搜索就会乱码。解决方案是在URL多加一个QueryString参数,叫做ie=utf8,那就解决问题了。这是一个Baidu自己使用的参数,可以让你省去服务器端转码的问题。
      

  7.   

    7楼的。百度那个代码不行,都不能进行搜索。只有Google那个代码好用、
      

  8.   

    其实就是因为你页面的编码和Baidu的编码不一样造成的.你只要在请求的时候写上
    Response.ContentEncoding  =  System.Text.Encoding.GetEncoding("GB2312");  就可以了.
      

  9.   


        自己手动在web.config里面配置···手写代码·
      

  10.   

    搜索结果是在baidu上显示的还是在自己网站上显示的
    如果是在baidu上显示的结果那我就晕
      

  11.   

    搜索结果是在百度页面上显示的呀,我的页面仅仅是引用了它的搜索条。就跟hao123上面的一样。
      

  12.   

    一:aspx页面添加百度搜索条时,搜索内容出现乱码问题已经解决:
       在web.config里(在<system.web>和</system.web>标记之间)手动添加一条内容即可:
       <globalization requestEncoding="gb2312"  responseEncoding="gb2312" />二,还没有解决的问题:  在asp.net中实现多邮箱登陆功能,和www.hao123.com上面的功能一样。
        期待高手指点迷津,本人是新手,希望详细一点