Getting the Redirected URL from the Original URL

前端 未结 9 1490
终归单人心
终归单人心 2020-12-05 14:57

I have a table in my database which contains the URLs of some websites. I have to open those URLs and verify some links on those pages. The problem is that some URLs get red

9条回答
  •  隐瞒了意图╮
    2020-12-05 15:01

    string url = ".......";
    var request = (HttpWebRequest)WebRequest.Create(url);
    var response = (HttpWebResponse)request.GetResponse();
    
    string redirectUrl = response.ResponseUri.ToString();
    

提交回复
热议问题