You need to use regular expression:
using System.Text.RegularExpressions;
Regex reg;
Match m;
string line = " http://localhost:4127/Project/articles/test-article-2766.aspx";
reg = new Regex(@"http://.*?/.*?/.*?/.*?(\d{4})");
m = reg.Match(line);
string str = m.Groups[1].ToString;
<edit>Error on Regex declaration, added the magical @ before the string