Thanks to safetyOtter, I just added this code to fix the problem:
string key = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\localhost";
RegistryKey localhost = Registry.CurrentUser.CreateSubKey(key);
localhost.SetValue("http", 1);