I set up my DefaultAppPool to redirect to /shorturl/Redirection.aspx. The redirection page could not parse the URL. There were several bugs with the parsing. Here they are, in order:
1. Request.QueryString["page"].ToString() is bad code. It does not properly check for NULL before calling .ToString(). This is crucial. I commented out that line of code.
2. oShortUrl = "http://gmlucid.localhost.com/shorturl/Redirection.aspx?404;http://gmlucid.localhost.com:80/Li4t5
This is not parsed properly by Utils.Clean() method or the RetrieveUrlFromDatabase() method.
3. The Utils.Clean code works for "AddUrlToDatabase(Container)" but NOT for "RetrieveUrlFromDatabase(oShortUrl)". The key here is oShortUrl.
LOOK at the CLEAN method!!! IT is not even doing anything!!!! Just creating a Regex, but not applying it to the URL at all.
public static string Clean(string url)
{
string filter = @"((https?):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)";
Regex rx = new Regex(filter);
return url;
}
LOOK at the CLEAN method!!! IT is not even doing anything!!!! Just creating a Regex, but not applying it to the URL at all.
Please Fix.