您的位置:程序门 -> vb -> 网络编程



用vb.net编写一个程序,登录到一个网站,然后需要一个服务器端跳转,怎样做服务器端跳转??  


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


用vb.net编写一个程序,登录到一个网站,然后需要一个服务器端跳转,怎样做服务器端跳转??
发表于:2008-02-22 10:00:53 楼主
用vb.net编写一个程序,登录到一个网站,然后需要一个服务器端跳转,怎样做服务器端跳转???  
我需要点击左侧的“本学期成绩”(状态栏显示http://210.41.243.121:7777/pls/wwwbks/bkscjcx.curscopre)才可以得到我想要的信息,怎么才可以用程序模拟这个动作呢??  

下面是已经写了的代码:可以得到刚刚登陆之后的页面信息,但是我需要的是点击http://210.41.243.121:7777/pls/wwwbks/bkscjcx.curscopre之后的信息  


imports       system.net  
imports       system.io  
imports       system.text  
public       class       form1  

                private       sub       button1_click(byval       sender       as       system.object,       byval       e       as       system.eventargs)       handles       button1.click  
                                dim       strid       as       string       =       "0605030609"  
                                dim       strpassword       as       string       =       "这里是密码"  

                                dim       encoding       as       asciiencoding       =       new       asciiencoding  
                                dim       postdata       as       string       =       "userid="       +       strid  
                                postdata       +=       ("&userpass="       +       strpassword)  

                                dim       data()       as       byte       =       encoding.getbytes(postdata)  

                                '               prepare               web               request...      
                                dim       myrequest       as       httpwebrequest       =       ctype(webrequest.create("http://210.41.243.121:8088/xsxt/index.jsp"),       httpwebrequest)  

                                myrequest.method       =       "post"  
                                myrequest.contenttype       =       "application/x-www-form-urlencoded"  
                                myrequest.contentlength       =       data.length  
                                dim       newstream       as       stream       =       myrequest.getrequeststream()  

                                'send               the               data.      
                                newstream.write(data,       0,       data.length)  
                                newstream.close()  
                                'get               response      
                                dim       myresponse       as       httpwebresponse       =       ctype(myrequest.getresponse(),       httpwebresponse)  
                                dim       reader       as       streamreader       =       new       streamreader(myresponse.getresponsestream(),       system.text.encoding.default)  
                                me.textbox1.text       =       reader.readtoend()  
                end       sub  
end       class  


谢谢!!  
谢谢
发表于:2008-02-22 13:47:351楼 得分:0
在aspx代码最后,写一段自动点击的js代码实现跳转
发表于:2008-02-22 23:07:322楼 得分:0
將跳轉的url,再獲取一次
发表于:2008-02-24 10:49:143楼 得分:0
楼上可以详细一点么?谢谢


快速检索

最新资讯
热门点击