Mercurial > pub > bltoolkit
comparison Demo/Asp.Net/Web/Global.asax @ 0:f990fcb411a9
Копия текущей версии из github
| author | cin |
|---|---|
| date | Thu, 27 Mar 2014 21:46:09 +0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:f990fcb411a9 |
|---|---|
| 1 <%@ Application Language="C#" %> | |
| 2 <%@ Import Namespace="System.Diagnostics" %> | |
| 3 <%@ Import Namespace="System.Web" %> | |
| 4 <%@ Import Namespace="PetShop.ObjectModel" %> | |
| 5 | |
| 6 <script RunAt="server"> | |
| 7 | |
| 8 // Carry over profile property values from an anonymous to an authenticated state. | |
| 9 // | |
| 10 void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs e) | |
| 11 { | |
| 12 ProfileCommon anonProfile = Profile.GetProfile(e.AnonymousID); | |
| 13 | |
| 14 // Merge anonymous shopping cart items to the authenticated shopping cart items. | |
| 15 // | |
| 16 foreach (CartItem cartItem in anonProfile.ShoppingCart.Items) | |
| 17 Profile.ShoppingCart.Add(cartItem); | |
| 18 | |
| 19 // Merge anonymous wishlist items to the authenticated wishlist items. | |
| 20 // | |
| 21 foreach (CartItem cartItem in anonProfile.WishList.Items) | |
| 22 Profile.WishList.Add(cartItem); | |
| 23 | |
| 24 // Clean up anonymous profile. | |
| 25 // | |
| 26 ProfileManager.DeleteProfile(e.AnonymousID); | |
| 27 AnonymousIdentificationModule.ClearAnonymousIdentifier(); | |
| 28 | |
| 29 // Save profile. | |
| 30 // | |
| 31 Profile.Save(); | |
| 32 } | |
| 33 | |
| 34 private static string LOG_SOURCE = ConfigurationManager.AppSettings["Event Log Source"]; | |
| 35 | |
| 36 // If an exception is thrown in the application then log it to an event log. | |
| 37 // | |
| 38 protected void Application_Error(object sender, EventArgs e) | |
| 39 { | |
| 40 Exception x = Server.GetLastError().GetBaseException(); | |
| 41 | |
| 42 EventLog.WriteEntry(LOG_SOURCE, x.ToString(), EventLogEntryType.Error); | |
| 43 } | |
| 44 | |
| 45 </script> |
