C# 知道 一个需要跳转的地址~~ 
怎么获得 ...那个跳转后的地址 WebRequest wrq = WebRequest.Create("http://community.csdn.net/Expert/TopicView2.asp?id=5283900");
                WebResponse wrs = wrq.GetResponse();
                Stream strm = wrs.GetResponseStream();
                StreamReader sr = new StreamReader(strm);
                richTextBox1.Text=sr.ReadToEnd();
                strm.Close();这样获得的不知道是什么内容,
 我需要下载的是这个地址转向后的内容~~

解决方案 »

  1.   

    这么获取的是当前页面的HTML代码
    你要地址转向后的内容需要自己分析这个页面所包含的跳转地址
      

  2.   

    譬如用你的这个方法获取
    http://book.sohu.com/20051012/n240526893.shtml
    页面得到的内容是下面这样 具体有没有跳转的html代码 你自己写个页面一次就知道了<base href=book.sohu.com>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <meta name="description" content="中间阶层的兴起与障碍-搜狐读书">
    <meta name="robots" content="all">
    <title>中间阶层的兴起与障碍-搜狐读书</title><STYLE type=text/css>
    .ui_top{color:#000000;font-size:12px;line-height:18px;}
    .ui_top a:link{color:#000000;text-decoration:none;}
    .ui_top a:visited{color:#000000;text-decoration:none;}
    .ui_top a:hover {color:#000000;text-decoration:underline;}.up1 {color:656565;line-height:18px;font-size:12px}
    .up1 td{color:#656565;line-height:18px;font-size:12px}
    .up1 A:link {color:#656565;text-decoration:none;line-height:18px;font-size:12px}
    .up1 A:Visited {color:#656565;text-decoration:none;}
    .up1 A:Hover {color:#656565;TEXT-DECORATION: underline;}/*ui:st*/
    td,body,input,select {font-size:12px;color:#000000;}
    a:hover {color:#cc0000;text-decoration: underline;}.ui_nav1,a.ui_nav1:visited {color: #D91200;line-height:20px;text-decoration: none;}
    a.ui_nav1:hover{color: #D91200;text-decoration:underline;}/*ui:end*/
    .c_title{font-size:26px;}
    .c_title2{font-size:11px;color:#DBF1FF;font-family:'arial,helvetica'}
    .c_title2 a:link{color:#DBF1FF;text-decoration:none;}
    .c_title2 a:visited{color:#DBF1FF;text-decoration:none;}
    .c_title2 a:hover {color:#DBF1FF;text-decoration:underline;}.c_content {font-size: 14px;color: #000000;line-height: 22px;}.c_tj{color:#ff0000;font-size:14px;font-weight:bold}
    .c_tj a:link{color:#ff0000;text-decoration:none;}
    .c_tj a:visited{color:#ff0000;text-decoration:none;}
    .c_tj a:hover {color:#ff0000;text-decoration:underline;}.c_tj1{color:#FE0205;font-size:12px;line-height:20px}
    .c_tj1 a:link{color:#FE0205;text-decoration:none;}
    .c_tj1 a:visited{color:#FE0205;text-decoration:none;}
    .c_tj1 a:hover {color:#FE0205;text-decoration:underline;}
    .c_tj2{color:#000000;font-size:12px;}
    .c_tj2 a:link{color:#000000;text-decoration:none;}
    .c_tj2 a:visited{color:#000000;text-decoration:none;}
    .c_tj2 a:hover {color:#000000;text-decoration:underline;}/* 新闻正文 */
    .content {
    font-size: 14px;
    color: #000000;
    text-decoration: none;
    line-height: 20px;
    }/*相关链接*/
    .c_xg{color:#0000FF;font-size:14px;line-height:20px;}
    .c_xg a:link{color:#0000FF;text-decoration:underline;}
    .c_xg a:visited{color:#0F0CBF;text-decoration:underline;}
    .c_xg a:hover {color:#cc0000;text-decoration:underline;}/*其它链接*/
    .c_qt{color:#0000FF;font-size:12px;line-height:18px;}
    .c_qt a:link{color:#0000FF;text-decoration:underline;}
    .c_qt a:visited{color:#0F0CBF;text-decoration:underline;}
    .c_qt a:hover {color:#cc0000;text-decoration:underline;}.s_date{color:#828282;font-size:9px;}.black {color:#000000;text-decoration: none;line-height: 18px;font-size: 12px;}
    .c_white {color:#ffffff;line-height:18px;font-size: 12px;}
    .eng{font-size:11px;font-family:'arial,helvetica'}.navigation A:link {color:#000000;text-decoration: none;line-height: 18px;font-size: 12px;}
    .navigation A:Visited {color:#000000;text-decoration: none;line-height: 18px;font-size: 12px;}
    .navigation A:Hover {COLOR: #cc0000; TEXT-DECORATION: underline; line-height: 18px; font-size: 12px;}.bg_title {background-color: #CFDBE4}
    .bg_relative {background-color: #00468C}
    .bg_right {background-color: #CFDBE4}
    </STYLE><script language="JavaScript">
    function fontZoom(size)
    {
     document.getElementById('fontzoom').style.fontSize=size+'px'
    }
    function checkName() {
            if (document.discuss.author.value=="") {
                    alert("请输入用户名,谢谢!");
                    return false;
            }
            return true;
    }
    function changeName() {
            if ( document.discuss.none.checked ) {
                    document.discuss.author.value = "匿名";
            }
    }
    function Validate(aForm)
       {
        var flag = document.send.msgType.value;
     if ( flag == 1 ) {
      if (aForm.Msg.value.length>45)
          {
          alert("短信超长,最多45个字!");
             aForm.Msg.focus();
             return (false);
          }
      if (aForm.ToNum.value.length<11)
      {
             alert("请输入目的手机号码!");
             aForm.ToNum.focus();
             return false;
      }
      if (aForm.UsrNum.value.length<11)
      {
             alert("请输入您的手机号码!");
             aForm.UsrNum.focus();
             return false;
      }
      if (aForm.UsrName.value.length>8)
      {
             alert("名字最多8个字!");
             aForm.UsrName.focus();
             return false;
      }
             return (true);
     } else {
      return chkemail(document.send.mailAddr.value);
     }
       }
       function setfocus()
       {
         send.Msg.focus();
       }
    </script>
    </head>
      

  3.   


    <body topmargin=0>
    <center>
    <img src=http://images.sohu.com/ccc.gif width=1 height=5><br>
    <SOHUHEADERCODE>
    <table width=760 border=0 cellpadding=0 cellspacing=0>
    <tr>
    <td bgcolor=#EFEBEF>
    <TABLE cellSpacing=0 cellPadding=0 border=0>
    <TBODY>
    <TR>
    <TD><IMG height=22 src="http://images.sohu.com/uiue/sohu_logo/2005/sohu_logo2.gif" 
    border=0></TD>
    <TD><A href="http://book.sohu.com/"><IMG height=22 alt=读书连载原创-搜狐网站 
    src="http://images.sohu.com/uiue/sohu_logo/2006/book_logo2.gif" 
    border=0></A></TD></TR></TBODY></TABLE>
    </td>
    <td align=right valign=bottom bgcolor=#EFEBEF>
    <TABLE cellSpacing=0 cellPadding=0 border=0>
    <TBODY>
    <TR>
    <TD class=ui_top vAlign=bottom align=right bgColor=#efebef><A 
    href="http://www.sohu.com/">搜狐首页</A><FONT style="FONT-SIZE: 6px"> </FONT>-<FONT 
    style="FONT-SIZE: 6px"> </FONT><A href="http://news.sohu.com/">新闻</A><FONT 
    style="FONT-SIZE: 6px"> </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A 
    href="http://sports.sohu.com/"><font color=#ff0000>体育</font></a><FONT style="FONT-SIZE: 6px"> </FONT>-<FONT 
    style="FONT-SIZE: 6px"> </FONT><A href="http://yule.sohu.com/">娱乐圈</A><FONT 
    style="FONT-SIZE: 6px"> </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A 
    href="http://business.sohu.com/">财经</A><FONT style="FONT-SIZE: 6px"> 
    </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A 
    href="http://it.sohu.com/">IT</A><FONT style="FONT-SIZE: 6px"> </FONT>-<FONT 
    style="FONT-SIZE: 6px"> </FONT><A href="http://auto.sohu.com/">汽车</A><FONT 
    style="FONT-SIZE: 6px"> </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A 
    href="http://house.sohu.com/">房产</A><FONT style="FONT-SIZE: 6px"> </FONT>-<FONT 
    style="FONT-SIZE: 6px"> </FONT><A href="http://women.sohu.com/">女人</A><FONT 
    style="FONT-SIZE: 6px"> </FONT><FONT style="FONT-SIZE: 6px"></FONT>-<FONT 
    style="FONT-SIZE: 6px"> </FONT><A href="http://sms.sohu.com/">短信</A><FONT 
    style="FONT-SIZE: 6px"> </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A 
    href="http://www.chinaren.com"><font color=ff0000>ChinaRen</font></A><FONT style="FONT-SIZE: 6px"> 
    </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A 
    href="http://login.mail.sohu.com/">邮件</A><FONT style="FONT-SIZE: 6px"> 
    </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A href="http://blog.sohu.com/">博客</A><FONT style="FONT-SIZE: 6px"> 
    </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A href="http://club.sohu.com/">BBS</A><FONT 
    style="FONT-SIZE: 6px"> </FONT>-<FONT style="FONT-SIZE: 6px"> </FONT><A 
    href="http://www.sogou.com"><FONT color=#ff0000>搜狗</FONT></A>&nbsp; 
    </TD></TR></TBODY></TABLE>
    </td>
    </tr>
    <tr><td height=3 colspan=3><img src=http://images.sohu.com/ccc.gif width=1 height=1></td></tr>
    </table>
    </SOHUHEADERCODE><!--内容开始 -->
    <table width=760 border=0 cellspacing=0 cellpadding=0>
    <tr><td colspan=3><img src=http://images.sohu.com/ccc.gif width=10 height=2></td></tr>
    <tr>
    <td  valign=top>
     <table width=590 border=0 cellspacing=0 cellpadding=0>
     <tr><td align=center colspan=2>
     <SOHUADCODE>
      <iframe width=590 height=80 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no bordercolor=#000000 src=http://images.sohu.com/chat_online/et/et59080.html></iframe></SOHUADCODE>
     </td></tr>
     <tr><td><img src=http://images.sohu.com/ccc.gif width=10 height=5></td></tr>
        <tr>
        <td width=470 valign=bottom class=navigation>
        <a href=http://book.sohu.com/>读书频道首页</a> &gt; <a href=http://nr.book.sohu.com/shuzhai.shtml>读书资讯</a> &gt; <a href=http://nr.book.sohu.com/ssyl.shtml>精彩书摘</a>
        </td>
        <td width=120 align=right>
       
      </td></tr>
    <tr><td colspan=2 valign=bottom><img src=http://images.sohu.com/ccc.gif width=5 height=3></td></tr>
    </table><table width=590 border=0 cellspacing=0 cellpadding=0>
    <tr><td colspan=3 height=1 bgcolor=#000000><img src=http://images.sohu.com/ccc.gif width=1 height=1></td></tr>
    <tr><td width=590 height=54 align=center colspan=3 class=c_title><b>
    中间阶层的兴起与障碍
    </b></td></tr>
    <tr><td colspan=3 height=1 bgcolor=#000000><img src=http://images.sohu.com/ccc.gif width=1 height=1></td></tr>
    <tr><td colspan=3><img src=http://images.sohu.com/ccc.gif width=1 height=2></td></tr>
    </table><table width=590 border=0 cellpadding=0 cellspacing=0>
    <tr class=bg_title>
    <td  class=c_tj2 align=center>
    &nbsp;&nbsp;时间:2005年10月12日15:30&nbsp;&nbsp;
    &nbsp;&nbsp;

    </td>
    <td width=100 class=c_tj2 align=center>
    <a href=http://comment.news.sohu.com/comment/topic.jsp?id=240526893 target=_blank><img src="http://news.sohu.com/images/lb.gif" width="15" height="15" alt="我来说两句" border=0 align="absmiddle">我来说两句(<span id="commentCount">0</span>)</a>
    </td>
    </tr>
    </table><table width=590 border=0 cellspacing=0 cellpadding=0>
    <form method="get" action="http://www.sogou.com/web" target="_blank">
     <tr>
      <td align=center class=c_tj2><a href=http://news.sohu.com/1/0402/03/subject200480346.shtml target=_blank class=black>热点排行</a></td>
    <td align=center class=c_tj1><a href="http://www.soq.com/news.htm" target=_blank>即时新闻通知</a></td>
    <td align=center class=c_tj2><a href="http://club.news.sohu.com/" target=_blank>进入新闻论坛</a></td>
    <td align=center class=c_tj2>相关新闻:<input type=text name=query size=12  value=""> <input type=submit value='搜索'></td>
     </tr>
    </form>
    </table>
    <table width=590 border=0 cellspacing=0 cellpadding=0>
    <tr><td height=1 bgcolor=#CCCCCC><img src=http://images.sohu.com/ccc.gif width=1 height=1></td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td height=5 bgcolor=#ffffff>
    <center><TABLE cellSpacing=0 cellPadding=0 width=508 border=0>
    <TBODY>
    <TR>
    <TD align=middle width="48%">
    <TABLE cellSpacing=0 cellPadding=0 width=244 border=0>
    <FORM name=SimpleSearchForm action=http://lz.book.sohu.com/slist.php method=get>
    <TBODY>
    <TR>
    <TD>连载</TD>
    <TD><INPUT class=s01 size=12 value=请输入关键字 name=text></TD>
    <TD><SELECT name=select> <OPTION value=1 selected>图书</OPTION> <OPTION 
    value=2>作者</OPTION> <OPTION value=3>出版社</OPTION></SELECT></TD>
    <TD><INPUT class=s02 type=submit value=搜索 name=submit></TD></TR></FORM></TBODY></TABLE></TD>
    <TD width=10></TD>
    <TD width=1 bgColor=#cecbce height=30></TD>
    <TD width=9></TD>
    <TD align=middle width="48%">
    <TABLE cellSpacing=0 cellPadding=0 width=244 border=0>
    <FORM name=SimpleSearchForm action=http://yc.book.sohu.com/series_list.php 
    method=get>
    <TBODY>
    <TR>
    <TD>原创</TD>
    <TD><INPUT class=s01 size=12 value=请输入关键字 name=text></TD>
    <TD><SELECT name=select> <OPTION value=1 selected>图书</OPTION> <OPTION 
    value=2>作者</OPTION></SELECT> </TD>
    <TD><INPUT class=s02 type=submit value=搜索 name=submit2></TD></TR></FORM></TBODY></TABLE></TD></TR></TBODY></TABLE><BR></center>
    </td></tr>
    <tr><td valign=top class=content id=fontzoom>
    <P>  日趋僵硬的跨越在西方,曾经为教育的普及是否能够实现社会平等而争论不休。西方早期的自由民主主义者认为,教育平等有助于缩小社会的不平等,政府应该通过各种努力兴办教育来实现社会的平等,这种观点为后来的功能主义者所认同。<table width="350" border="0" cellspacing="4" cellpadding="0" align="left">
    <tr>
    <td>
    <iframe width=350 height=250 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no bordercolor=#000000 src=http://images.sohu.com/chat_online/et/etpip.html></iframe>
    </td>
    </tr>
    </table
      

  4.   

    !!!!!!!!!!!!!111
      http://community.csdn.net/Expert/TopicView2.asp?id=5283900   并没有包含什么跳转代码啊~~  
       它直接跳转到~~ http://community.csdn.net/Expert/topic/5283/5283900.xml?temp=.307583  
      

  5.   

    可以用HttpWebRequest,它有一个属性是:AllowAutoRedirect