Login.aspx
Users can always pass Click The "Sign in" Button in the header (_header.ascx).
IBuyspy is using Forms-based Authentication, Which is enabled by MAKING A
Entry in the application's web.config file.
Some pages (Checkout.aspx ...) must be certified by users to enter, how to determine if the user authenticated users? These pages are not written in this page to verify that the entrant is authenticated. They are set to access obstacles in the middle of Web.config.
So, in the case where these pages cannot be entered, we will jump to another page, and the jump to which page is also Web.config to set it. The Loginurl Attribute Specifies The Login Page Time A User Attempts to Access Anonymous Access This.
In the Login.aspx page:
If login is successful, then The Loginbtn_Click Event Handler Performs Three Important ActionS: Checks the code. 1. Turn the items in the temporary CART to your personal CART so that information will not be lost and help in the future. ShoppingCart.migratecart (TempcartID, Customerid); actually, just change the TemperaryID of the original shopping cart to the user's name.
2, give the client a Personalization cookie, then you can see Customed Personal Welcome when entering Default.aspx later. Response.cookies ["iBuysPy_Fullname"]. Value = CustomerDetails.FullName;
3, call RedirectFromLoginPage () Static Method, this is a built-in asp.net class. The role is: This Method issued a MAC encrypted cookie authentication Ticket to the client browser to confirm the authenticated customer UserName. In this program, we use the Customer ID as a customer's certification name. In the subsequent request for this program, we can still use this username. After issuing authentication Ticket to the client browser, this Method is RedirectFromLogInPage () enables the browser to return to the login page navigation Came from. (Originating Page? DEFAULT.ASPX, in fact, what is the meaning: if trying to enter restricked On the page, you still haven't login, will redirect to login page, then return to the restricked page, if it is directly click on the SIGN label above, then return to default.page (Customerid, Rememberlogin). Checked); In fact, Customerid used to sign the user's identity is the user's shoppingcartid, which is used to mark the shopping cart. From this code, you can see: // migrate any existing shopping cart.coms Into the Permanent Shopping Cart ShoppingCart.migrateCart ( TempcartID, Customerid;
1, Customerid is determined by the username and password of login: iBuyspy.customersdb accountsystem = new ibuyspy.customersdb (); string customerid = accountsystem.login (email.text, password.text);
2. ShoppingCartID is determined by the username (already logged in) or the tempeRYID. IBuySpy.ShoppingCartDB shoppingCart = new IBuySpy.ShoppingCartDB (); String tempCartID = shoppingCart.GetShoppingCartId (); In reality, the situation really is true: // If the user is authenticated, use their customerId as a permanent shopping cart id if ( Context.user.Identity.Name! = "") {return context.user.Identity.name;}
We see how it generates a Personalization cookie, how is it generated?
// Lookup The Customer's Full Account Details
AspnetCommerce.customerDetails CustomerDetails =
Accountsystem.getCustomerDetails (Customerid);
// Store The User's Fullname In a cookie for Personalization PurposeSResponse.cookies ["ASPNETCOMMERCE_FULLNAME"]. Value = CustomerDetails.FullName
// Make the cookie persistent only if the user selects
// "Persistent" login checkbox
IF (RememberLogin.Checked == true)
{
Response.cookies ["ASPNETCOMMERCE_FULLNAME"]. EXPIRES =
Datetime.now.addmonths (1);
}
If you don't choose Checked == True, then Cookie is Destory when User Ends The Session.
Session & cookies See Asp.net