How To Get The Redirected URL From Original URL Visual Basic .NET

不问归期 提交于 2019-12-04 14:06:47

My Problem is now solved, thanks to google and Daniweb here is solution

Dim req As HttpWebRequest = DirectCast(HttpWebRequest.Create("Your short URL here"), HttpWebRequest)
        Dim response As HttpWebResponse
        Dim resUri As String
        response = req.GetResponse
        resUri = response.ResponseUri.AbsoluteUri
        MsgBox(resUri)

this will return URL_2.

Why don't you pass the original URL as a query string parameter? i.e. in url_1, redirect to: http://pastehtml.com/view/b95qx66rc.html?redirectfrom=http://goo.gl/ouCeb

Then in url_2 use this code:

Dim OriginalURL As String = request.querystring("redirectfrom")

URL_2 = "http://" & URL_1 & "/view/b95qx66rc.html"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!