I found the solution. I needed to add at the end of the code.
Response.Headers.Add("Location", session.Url);