diff --git a/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php b/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php
index 703f08f0a12103f0a9167869eda5a89819035de9..4c934ae2f67241576385d681200a5bb839a8da50 100644
--- a/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php
+++ b/lib/SimpleSAML/Bindings/SAML20/HTTPPost.php
@@ -192,16 +192,10 @@ class SimpleSAML_Bindings_SAML20_HTTPPost {
 		
 		} else {
 
-			$p = new SimpleSAML_XHTML_Template($this->configuration, 'post.php');
-	
-			$p->data['RelayStateName'] = 'RelayState';
-			$p->data['RelayState'] = $relayState;
-			$p->data['destination'] = $destination;
-			$p->data['response'] = base64_encode($response);
-			
-			$p->show();
-
-		
+			SimpleSAML_Utilities::postRedirect($destination, array(
+				'RelayState' => $relayState,
+				'SAMLResponse' => base64_encode($response),
+			));
 		}
 		
 		
diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
index 8b6a14e26986eda04b03882a4e8632b98935a252..68a0051eb162b061b9f3e9a33db272fe6f849e36 100644
--- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
+++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php
@@ -94,12 +94,10 @@ class SimpleSAML_Bindings_Shib13_HTTPPost {
 			$p->show();
 
 		} else {
-			$p = new SimpleSAML_XHTML_Template($this->configuration, 'post.php');
-			$p->data['RelayStateName'] = 'TARGET';
-			$p->data['RelayState'] = $relayState;
-			$p->data['destination'] = $shire;
-			$p->data['response'] = base64_encode($response);
-			$p->show();
+			SimpleSAML_Utilities::postRedirect($destination, array(
+				'TARGET' => $relayState,
+				'SAMLResponse' => base64_encode($response),
+			));
 		}
 
 	}