本文介绍了如何在请求后将重定向的url作为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如在任何tinyurl / ajdeijad链接上(这个是假的),think重定向到另一个url
For example on any tinyurl/ajdeijad link (this one is fake), the think redirects to another url
这是我的代码:
Dim request1 As HttpWebRequest = DirectCast(HttpWebRequest.Create(urlvimeohd), HttpWebRequest)
request1.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1"
request1.MaximumAutomaticRedirections = 1
request1.AllowAutoRedirect = True
如何检索响应的网址(重定向!)
How do you retrieve the url of the response (it redirects!)
推荐答案
简单 - 只需获得响应的响应!
Simple - just get the reponseuri of the response!
dim myresponse as request1.getresponse()
dim x as string = myresponse.ResponseURI
这篇关于如何在请求后将重定向的url作为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!