| 发表于: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 谢谢!! 谢谢 |
|
|
|
|