diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-18 16:56:00 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-06-18 16:56:00 -0700 |
commit | f338389459e9f8bcb26ace53c698ae35484cac5c (patch) | |
tree | 4b7db7651541043f61299e8acf97038ddfa9152f | |
parent | b47b05c1450398c4f0760544093837e8a864b700 (diff) | |
download | DotNetOpenAuth-f338389459e9f8bcb26ace53c698ae35484cac5c.zip DotNetOpenAuth-f338389459e9f8bcb26ace53c698ae35484cac5c.tar.gz DotNetOpenAuth-f338389459e9f8bcb26ace53c698ae35484cac5c.tar.bz2 |
Added more logging and conditions for mono.
-rw-r--r-- | samples/OpenIdRelyingPartyMvc/Global.asax.cs | 3 | ||||
-rw-r--r-- | samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj | 6 | ||||
-rw-r--r-- | samples/OpenIdRelyingPartyMvc/Web.config | 28 | ||||
-rw-r--r-- | src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs | 5 |
4 files changed, 40 insertions, 2 deletions
diff --git a/samples/OpenIdRelyingPartyMvc/Global.asax.cs b/samples/OpenIdRelyingPartyMvc/Global.asax.cs index d57a13f..8b117c0 100644 --- a/samples/OpenIdRelyingPartyMvc/Global.asax.cs +++ b/samples/OpenIdRelyingPartyMvc/Global.asax.cs @@ -18,13 +18,16 @@ "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = string.Empty }); // Parameter defaults +#if !Mono routes.MapRoute( "Root", string.Empty, new { controller = "Home", action = "Index", id = string.Empty }); +#endif } protected void Application_Start(object sender, EventArgs e) { + log4net.Config.XmlConfigurator.Configure(); RegisterRoutes(RouteTable.Routes); } } diff --git a/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj b/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj index a6fab7c..563cdbc 100644 --- a/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj +++ b/samples/OpenIdRelyingPartyMvc/OpenIdRelyingPartyMvc.csproj @@ -17,7 +17,7 @@ <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> + <DefineConstants>TRACE;DEBUG;Mono</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> @@ -30,6 +30,10 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\lib\log4net.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Core"> diff --git a/samples/OpenIdRelyingPartyMvc/Web.config b/samples/OpenIdRelyingPartyMvc/Web.config index ba97122..a27f321 100644 --- a/samples/OpenIdRelyingPartyMvc/Web.config +++ b/samples/OpenIdRelyingPartyMvc/Web.config @@ -10,6 +10,7 @@ <configuration> <configSections> <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" /> <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> @@ -33,7 +34,7 @@ </uri> <system.net> - <defaultProxy enabled="true" /> + <!--<defaultProxy enabled="true" />--> <!-- mono unsupported --> <settings> <!-- This setting causes .NET to check certificate revocation lists (CRL) before trusting HTTPS certificates. But this setting tends to not @@ -59,6 +60,31 @@ </messaging> </dotNetOpenAuth> + <!-- log4net is a 3rd party (free) logger library that dotnetopenid will use if present but does not require. --> + <log4net> + <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> + <file value="RelyingParty.log" /> + <appendToFile value="true" /> + <rollingStyle value="Size" /> + <maxSizeRollBackups value="10" /> + <maximumFileSize value="100KB" /> + <staticLogFileName value="true" /> + <layout type="log4net.Layout.PatternLayout"> + <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" /> + </layout> + </appender> + <!-- Setup the root category, add the appenders and set the default level --> + <root> + <level value="INFO" /> + <!--<appender-ref ref="RollingFileAppender" />--> + <appender-ref ref="RollingFileAppender" /> + </root> + <!-- Specify the level for some specific categories --> + <logger name="DotNetOpenAuth"> + <level value="INFO" /> + </logger> + </log4net> + <appSettings/> <connectionStrings/> <system.web> diff --git a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs index 5908779..c8014b3 100644 --- a/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs +++ b/src/DotNetOpenAuth/Messaging/HttpRequestInfo.cs @@ -57,6 +57,7 @@ namespace DotNetOpenAuth.Messaging { this.Url = request.Url; this.UrlBeforeRewriting = GetPublicFacingUrl(request); this.RawUrl = request.RawUrl; + Logger.Messaging.InfoFormat("Url: {0}, RawUrl: {1}", this.Url, this.RawUrl); this.Headers = GetHeaderCollection(request.Headers); this.InputStream = request.InputStream; @@ -323,6 +324,7 @@ namespace DotNetOpenAuth.Messaging { // HttpRequest.Url gives us the internal URL in a cloud environment, // So we use a variable that (at least from what I can tell) gives us // the public URL: +#if !Mono // In ASP.NET MVC, Mono adds UrlRouting.axd to the URL here, which breaks OpenID return_to verification. if (request.ServerVariables["HTTP_HOST"] != null) { ErrorUtilities.VerifySupported(request.Url.Scheme == Uri.UriSchemeHttps || request.Url.Scheme == Uri.UriSchemeHttp, "Only HTTP and HTTPS are supported protocols."); UriBuilder publicRequestUri = new UriBuilder(request.Url); @@ -335,6 +337,7 @@ namespace DotNetOpenAuth.Messaging { } return publicRequestUri.Uri; } else { +#endif // Failover to the method that works for non-web farm enviroments. // We use Request.Url for the full path to the server, and modify it // with Request.RawUrl to capture both the cookieless session "directory" if it exists @@ -344,7 +347,9 @@ namespace DotNetOpenAuth.Messaging { // Response.ApplyAppPathModifier(builder.Path) would have worked for the cookieless // session, but not the URL rewriting problem. return new Uri(request.Url, request.RawUrl); +#if !Mono } +#endif } /// <summary> |