summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-11-03 11:48:37 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-11-03 11:48:37 -0800
commitb13badacaeddc376c563889c472d64812cc8e8d3 (patch)
tree93ea46d85796f8f8ebae07356d739863fa07a5de
parent71bc6d9e10f7f49e6229121d8257c90df2563cb1 (diff)
downloadDotNetOpenAuth-b13badacaeddc376c563889c472d64812cc8e8d3.zip
DotNetOpenAuth-b13badacaeddc376c563889c472d64812cc8e8d3.tar.gz
DotNetOpenAuth-b13badacaeddc376c563889c472d64812cc8e8d3.tar.bz2
Fixes issue with MVC OP sample when run in IIS Integrated Pipeline mode.
Resolves Trac #140.
-rw-r--r--samples/OpenIdProviderMvc/Global.asax.cs19
1 files changed, 17 insertions, 2 deletions
diff --git a/samples/OpenIdProviderMvc/Global.asax.cs b/samples/OpenIdProviderMvc/Global.asax.cs
index c848c1c..8390c46 100644
--- a/samples/OpenIdProviderMvc/Global.asax.cs
+++ b/samples/OpenIdProviderMvc/Global.asax.cs
@@ -14,6 +14,8 @@
/// visit http://go.microsoft.com/?LinkId=9394801
/// </remarks>
public class MvcApplication : System.Web.HttpApplication {
+ private static object behaviorInitializationSyncObject = new object();
+
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
@@ -33,8 +35,21 @@
protected void Application_Start() {
RegisterRoutes(RouteTable.Routes);
- DotNetOpenAuth.OpenId.Behaviors.PpidGeneration.PpidIdentifierProvider = new Code.AnonymousIdentifierProvider();
- DotNetOpenAuth.OpenId.Behaviors.GsaIcamProfile.PpidIdentifierProvider = new Code.AnonymousIdentifierProvider();
+ }
+
+ protected void Application_BeginRequest(object sender, EventArgs e) {
+ InitializeBehaviors();
+ }
+
+ private static void InitializeBehaviors() {
+ if (DotNetOpenAuth.OpenId.Behaviors.PpidGeneration.PpidIdentifierProvider == null) {
+ lock (behaviorInitializationSyncObject) {
+ if (DotNetOpenAuth.OpenId.Behaviors.PpidGeneration.PpidIdentifierProvider == null) {
+ DotNetOpenAuth.OpenId.Behaviors.PpidGeneration.PpidIdentifierProvider = new Code.AnonymousIdentifierProvider();
+ DotNetOpenAuth.OpenId.Behaviors.GsaIcamProfile.PpidIdentifierProvider = new Code.AnonymousIdentifierProvider();
+ }
+ }
+ }
}
}
} \ No newline at end of file