Public Class CreateAccount_Success
    Inherits System.Web.UI.Page

    Protected Sub Page_Load() Handles Me.Load
        If SessionVars.DriverId(Session) = 0 Then Exit Sub
        
        Dim req = SessionVars.PostLoginUrl(Session)
        SessionVars.PostLoginUrl(Session) = ""
        If req.Length AndAlso _IsSameOrigin(req) Then
            Response.Redirect(req)
        End If
    End Sub

    Private Function _IsSameOrigin(other As String) As Boolean
        If Not New Uri(other).IsAbsoluteUri Then
            other = My.Settings.baseUrl & other
        End If
        Return 0 = Uri.Compare(Request.Url, New Uri(other),
            UriComponents.SchemeAndServer, UriFormat.SafeUnescaped, StringComparison.Ordinal)
    End Function

End Class