diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-02 20:08:38 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-04-02 20:08:38 -0700 |
commit | 1635531cac0803c436fdece953f51bab322c89cc (patch) | |
tree | eb968b8f5e0c3faa644a54485ef69bdce937cbf1 /src/DotNetOpenAuth.Core/Messaging | |
parent | be43c216a4904d445115a6efbecb5e7394837efc (diff) | |
download | DotNetOpenAuth-1635531cac0803c436fdece953f51bab322c89cc.zip DotNetOpenAuth-1635531cac0803c436fdece953f51bab322c89cc.tar.gz DotNetOpenAuth-1635531cac0803c436fdece953f51bab322c89cc.tar.bz2 |
Moved code to calculate a web root into DNOA.Core.
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging')
-rw-r--r-- | src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs | 13 |
1 files changed, 13 insertions, 0 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> |