Last active
January 15, 2016 19:17
-
-
Save miklund/63886c4051626ee9f2a6 to your computer and use it in GitHub Desktop.
2008-11-20 EPiServer: Page Not Found!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Title: EPiServer: Page Not Found! | |
# Author: Mikael Lundin | |
# Link: http://blog.mikaellundin.name/2008/11/20/episerver-page-not-found.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Global : EPiServer.Global | |
{ | |
public void Application_Start(object sender, EventArgs e) | |
{ | |
DataFactory.Instance.DeletingPage += new PageEventHandler(UnsubscribePage); | |
} | |
public static void UnsubscribePage(object sender, PageEventArgs e) | |
{ | |
int i = 0; | |
int totalPages = 0; | |
ProfileInfoCollection profiles = | |
ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All, i++, 100, out totalPages); | |
foreach (ProfileInfo profile in profiles) | |
{ | |
EPiServerProfile epProfile = EPiServerProfile.Get(profile.UserName); | |
epProfile.SubscriptionInfo.UnSubscribe(e.PageLink); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static PageExists(this DataFactory instance, PageReference pageLink) | |
{ | |
try { DataFactory.Instance.GetPage(pageLink); return true; } | |
catch (PageNotFoundException) { return false; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment