now we use cookie to save the necessary states before commit submit redirect.