How to check whether the URLs is redirecting or not


Im trying to check the status of URL, whether the URL has redirecting or broken link. I’ve tried with HTTPs activity its give me the status of URL not the response. Example if i open “” its redirecting to “”. I want to get the status as 301 or 302 and the redirected link. By using HTTPS activity its give me status as 200. Any other option?

Any suggestion.

redirect.xaml (6.7 KB)

Thanks @vvaidya,

Its working fine, but if i pass a broken link its throwing an exception.

“Message: The remote server returned an error: (404) Not Found.” If Status is 404 how to save this value to a variable.

Surround the code by Try Catch and in the catch block:

1)use “System.Net.Webexception” and assign ex.Status.ToString to your Variable

2)also use “System.Exception” for other errors.

I don’t think order matters.



Can you please provide us an example.


redirect_exception.xaml (12.9 KB)

@vvaidya, Hey, i have tried using this code for a link on which redirect is applied but it is throwing 401 error. Do you know why?