Edit: Didn't see #2 as an intermediate URL when I read the question, it looked like it was the (only) redirect action. Depending on your browser of choice, and the type of redirect performed, you can use Selenium to read the page referrer and get the redirect.
WebDriver driver; // Assigned elsewhere
JavascriptExecutor js = (JavascriptExecutor) driver;
// Call any javascript
var referrer = js.executeScript("document.referrer");
I would recommend Selenium Webdriver for all your web site/app testing needs in C#. It integrates very nicely with NUnit, MSTest and other test frameworks - it's very easy to use.
With Selenium Webdriver, you will start an automated browser instance (Firefox, Chrome, Internet Explorer, PhantomJS and others) from your C# testing code. You will then control the browser with simple commands, like "go to url" or "enter text in input box" or "click button". See more in the API.
It doesn't require much from other developers either - they just run the test suite, and assuming they have the browser installed, it will work. I've used it successfully with hundreds of tests across a team of developers who each had different browser preferences (even for the testing, which we each tweaked) and on the team build server.
For this test, I would go to the url in step 1, then wait for a second, and read the url in step 3.
Here is some sample code, adapated from Introducing the Selenium-WebDriver API by Example. Since I don't know the URL nor {string}
("cheese" in this example) you are looking for, the sample hasn't changed much.
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
// Requires reference to WebDriver.Support.dll
using OpenQA.Selenium.Support.UI;
class RedirectThenReadUrl
{
static void Main(string[] args)
{
// Create a new instance of the Firefox driver.
// Notice that the remainder of the code relies on the interface,
// not the implementation.
// Further note that other drivers (InternetExplorerDriver,
// ChromeDriver, etc.) will require further configuration
// before this example will work. See the wiki pages for the
// individual drivers at http://code.google.com/p/selenium/wiki
// for further information.
IWebDriver driver = new FirefoxDriver();
//Notice navigation is slightly different than the Java version
//This is because 'get' is a keyword in C#
driver.Navigate().GoToUrl("http://www.google.com/");
// Print the original URL
System.Console.WriteLine("Page url is: " + driver.Url);
// @kirbycope: In your case, the redirect happens here - you just have
// to wait for the new page to load before reading the new values
// Wait for the page to load, timeout after 10 seconds
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until((d) => { return d.Url.ToLower().Contains("cheese"); });
// Print the redirected URL
System.Console.WriteLine("Page url is: " + driver.Url);
//Close the browser
driver.Quit();
}
}