Index: wp-pass.php
===================================================================
--- wp-pass.php	(revision 2430)
+++ wp-pass.php	(working copy)
@@ -7,6 +7,5 @@
 // 10 days
 setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH);
 
-header('Location: ' . $_SERVER['HTTP_REFERER']);
-
+wp_redirect($_SERVER['HTTP_REFERER']);
 ?>
\ No newline at end of file
Index: wp-login.php
===================================================================
--- wp-login.php	(revision 2430)
+++ wp-login.php	(working copy)
@@ -184,7 +184,7 @@
 				wp_setcookie($user_login, $user_pass);
 			}
 			do_action('wp_login', $user_login);
-			header("Location: $redirect_to");
+			wp_redirect($redirect_to);
 			exit();
 		} else {
 			if ($using_cookie)			
Index: wp-comments-post.php
===================================================================
--- wp-comments-post.php	(revision 2431)
+++ wp-comments-post.php	(working copy)
@@ -52,6 +52,5 @@
 
 $location = (empty($_POST['redirect_to'])) ? $_SERVER["HTTP_REFERER"] : $_POST['redirect_to']; 
 
-header("Location: $location");
-
+wp_redirect($location);
 ?>
\ No newline at end of file
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 2432)
+++ wp-includes/functions.php	(working copy)
@@ -1711,6 +1711,19 @@
 }
 endif;
 
+// Cookie safe redirect.  Works around IIS Set-Cookie bug.
+// http://support.microsoft.com/kb/q176113/
+if ( !function_exists('wp_redirect') ) :
+function wp_redirect($location) {
+	global $is_IIS;
+
+	if ($is_IIS)
+		header("Refresh: 0;url=$location");
+	else
+		header("Location: $location");
+}
+endif;
+
 function is_plugin_page() {
 	global $plugin_page;
 
Index: wp-includes/vars.php
===================================================================
--- wp-includes/vars.php	(revision 2430)
+++ wp-includes/vars.php	(working copy)
@@ -35,6 +35,7 @@
 
 // Server detection
 $is_apache = strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') ? 1 : 0;
+$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0;
 
 // if the config file does not provide the smilies array, let's define it here
 if (!isset($wpsmiliestrans)) {
Index: wp-admin/options.php
===================================================================
--- wp-admin/options.php	(revision 2430)
+++ wp-admin/options.php	(working copy)
@@ -84,7 +84,7 @@
 		$referred = remove_query_arg('updated' , $_SERVER['HTTP_REFERER']);
 		$goback = add_query_arg('updated', 'true', $_SERVER['HTTP_REFERER']);
 		$goback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $goback);
-    header('Location: ' . $goback);
+		wp_redirect($goback);
     break;
 
 default:
Index: wp-admin/profile.php
===================================================================
--- wp-admin/profile.php	(revision 2430)
+++ wp-admin/profile.php	(working copy)
@@ -86,7 +86,7 @@
 
 	$result = $wpdb->query("UPDATE $wpdb->users SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description', user_nicename = '$newuser_nicename' WHERE ID = $user_ID");
 
-	header('Location: profile.php?updated=true');
+	wp_redirect('profile.php?updated=true');
 break;
 
 case 'IErightclick':
Index: wp-admin/link-manager.php
===================================================================
--- wp-admin/link-manager.php	(revision 2430)
+++ wp-admin/link-manager.php	(working copy)
@@ -243,7 +243,7 @@
 	  WHERE link_id=$link_id");
     } // end if save
     setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
-    header('Location: ' . $this_file);
+    wp_redirect($this_file);
     break;
   } // end Save
 
@@ -267,7 +267,7 @@
     }
     $links_show_cat_id = $cat_id;
     setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
-    header('Location: '.$this_file);
+    wp_redirect($this_file);
     break;
   } // end Delete
 

