summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-04-02 20:08:38 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-04-02 20:08:38 -0700
commit1635531cac0803c436fdece953f51bab322c89cc (patch)
treeeb968b8f5e0c3faa644a54485ef69bdce937cbf1
parentbe43c216a4904d445115a6efbecb5e7394837efc (diff)
downloadDotNetOpenAuth-1635531cac0803c436fdece953f51bab322c89cc.zip
DotNetOpenAuth-1635531cac0803c436fdece953f51bab322c89cc.tar.gz
DotNetOpenAuth-1635531cac0803c436fdece953f51bab322c89cc.tar.bz2
Moved code to calculate a web root into DNOA.Core.
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs13
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Realm.cs6
2 files changed, 14 insertions, 5 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
index 42ba18e..4e75145 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
@@ -327,6 +327,19 @@ namespace DotNetOpenAuth.Messaging {
}
/// <summary>
+ /// Gets the URL to the root of a web site, which may include a virtual directory path.
+ /// </summary>
+ /// <returns>An absolute URI.</returns>
+ internal static Uri GetWebRoot() {
+ HttpRequestBase requestInfo = new HttpRequestWrapper(HttpContext.Current.Request);
+ UriBuilder realmUrl = new UriBuilder(requestInfo.GetPublicFacingUrl());
+ realmUrl.Path = HttpContext.Current.Request.ApplicationPath;
+ realmUrl.Query = null;
+ realmUrl.Fragment = null;
+ return realmUrl.Uri;
+ }
+
+ /// <summary>
/// Clears any existing elements in a collection and fills the collection with a given set of values.
/// </summary>
/// <typeparam name="T">The type of value kept in the collection.</typeparam>
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs b/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs
index d682542..1453d68 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs
@@ -126,11 +126,7 @@ namespace DotNetOpenAuth.OpenId {
Requires.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired);
Contract.Ensures(Contract.Result<Realm>() != null);
- HttpRequestBase requestInfo = new HttpRequestWrapper(HttpContext.Current.Request);
- UriBuilder realmUrl = new UriBuilder(requestInfo.GetPublicFacingUrl());
- realmUrl.Path = HttpContext.Current.Request.ApplicationPath;
- realmUrl.Query = null;
- realmUrl.Fragment = null;
+ var realmUrl = new UriBuilder(MessagingUtilities.GetWebRoot());
// For RP discovery, the realm url MUST NOT redirect. To prevent this for
// virtual directory hosted apps, we need to make sure that the realm path ends