Selasa, 27 Juli 2010

Make The WebClient Class follow redirects and get Target Url

How to make the .NET WebClient class follow redirects and get the target urlUnlike its brother HttpWebRequest, the WebClient class automatically follows redirects, but if you need to get the "final" url, you'll need to "wrap" your WebClient in a class that derives from System.Net.WebClient. Here's an example: using System;using System.Net;public class MyWebClient : WebClient { Uri _responseUri;

Tidak ada komentar:

Posting Komentar