Imports BVSoftware.BVC.Core Public Class Checkout_Login Inherits BaseStorePage Protected WithEvents LoginControl1 As LoginControl Protected WithEvents CSSTag1 As BVSoftware.WebControls.CSSTag Protected WithEvents NewUserControl1 As NewUserControl #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Protected WithEvents MetaDescriptionControl As BVSoftware.WebControls.MetaTag Protected WithEvents MetaKeywordsControl As BVSoftware.WebControls.MetaTag 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() 'SP2- Assures that SSL is used for this page if set up Me.RequiresSSL = True '-SP2 End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then MetaKeywordsControl.Content = WebAppSettings.MetaKeywords MetaDescriptionControl.Content = WebAppSettings.MetaDescription CSSTag1.StyleSheetURL = PersonalizationServices.GetPersonalizedStyleSheet PageTitle = "Login" End If If Not Page.IsPostBack Then GetPassedAuthenticationTokens() End If If Me.LoginControl1.UserName.Length < 1 Then PopulateRememberedUsers() End If End Sub Private Sub GetPassedAuthenticationTokens() Dim Crypto As New BVSoftware.Encryption.DESEncryption ' Cart If Request.Params("CID") <> Nothing Then Dim cart As Orders.Order = OrderServices.GetExistingOrder(Crypto.Decode(Request.Params("CID"))) If Not cart Is Nothing Then Session("cartID") = cart.ID End If cart = Nothing End If ' User If Request.Params("AUID") <> Nothing Then Dim uid As Integer = Crypto.Decode(Request.Params("AUID")) Dim thisUser As Membership.UserAccount = MembershipServices.GetUserByID(uid) If Not thisUser Is Nothing Then Session("AuthenticatedUser") = thisUser AssignOrderToUser(thisUser.ID, thisUser.UserName) BVC2004Store.RunCheckout() Else PopulateLoginForm(uid) End If Else ' Populate User Name if passed If Request.Params("UN") <> Nothing Then Me.LoginControl1.UserName = Crypto.Decode(Request.Params("UN")) End If End If Crypto = Nothing End Sub Private Sub PopulateLoginForm(ByVal userID As Integer) Dim u As Membership.UserAccount u = MembershipServices.GetUserByID(userID) If Not u Is Nothing Then Me.LoginControl1.UserName = u.UserName End If u = Nothing End Sub Private Sub PopulateRememberedUsers() Dim checkCookie As HttpCookie checkCookie = Request.Cookies(WebAppSettings.UserCookieName) If Not checkCookie Is Nothing Then Me.LoginControl1.UserName = checkCookie.Value End If checkCookie = Nothing End Sub Private Sub AssignOrderToUser(ByVal userID As Integer, ByVal userName As String) Dim thisOrder As Orders.Order = BVC2004Store.GetCurrentShoppingCart If Not thisOrder Is Nothing Then thisOrder.UserID = BVC2004Store.GetCurrentUser.ID thisOrder.UserName = BVC2004Store.GetCurrentUser.UserName OrderServices.SaveOrder(thisOrder) End If thisOrder = Nothing End Sub Private Sub LoginControl1_LoginCompleted(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginControl1.LoginCompleted, NewUserControl1.LoginCompleted 'Response.Redirect("Checkout_Address.aspx") BVC2004Store.RunCheckout() End Sub End Class