summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-11-16 21:35:02 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-11-16 21:35:02 -0800
commit5e969e0d7a5fa23cc1b35e15b67e089f43db2786 (patch)
treefbfb1a20d34a034c16382146cac7bfd3b76378c9
parent6151cb6bb26ddf863f09e0990921e86bba44fd92 (diff)
downloadDotNetOpenAuth-5e969e0d7a5fa23cc1b35e15b67e089f43db2786.zip
DotNetOpenAuth-5e969e0d7a5fa23cc1b35e15b67e089f43db2786.tar.gz
DotNetOpenAuth-5e969e0d7a5fa23cc1b35e15b67e089f43db2786.tar.bz2
Fixed the no-redirect issue when users navigate to /login.aspx to log into the RP template.
-rw-r--r--projecttemplates/WebFormsRelyingParty/Code/SiteUtilities.cs (renamed from projecttemplates/WebFormsRelyingParty/Code/Utilities.cs)4
-rw-r--r--projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs7
-rw-r--r--projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs4
-rw-r--r--projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj2
4 files changed, 11 insertions, 6 deletions
diff --git a/projecttemplates/WebFormsRelyingParty/Code/Utilities.cs b/projecttemplates/WebFormsRelyingParty/Code/SiteUtilities.cs
index 43c5236..101d978 100644
--- a/projecttemplates/WebFormsRelyingParty/Code/Utilities.cs
+++ b/projecttemplates/WebFormsRelyingParty/Code/SiteUtilities.cs
@@ -1,5 +1,5 @@
//-----------------------------------------------------------------------
-// <copyright file="Utilities.cs" company="Andrew Arnott">
+// <copyright file="SiteUtilities.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
@@ -11,7 +11,7 @@ namespace WebFormsRelyingParty.Code {
using System.Security.Cryptography;
using System.Web;
- public static class Utilities {
+ public static class SiteUtilities {
private const string CsrfCookieName = "CsrfCookie";
private static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider();
diff --git a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
index 0857019..9e708bc 100644
--- a/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/LoginFrame.aspx.cs
@@ -103,7 +103,12 @@
Uri topWindowUri = new Uri(this.topWindowUrl.Value);
string returnUrl = HttpUtility.ParseQueryString(topWindowUri.Query)["ReturnUrl"];
if (string.IsNullOrEmpty(returnUrl)) {
- Response.Redirect(this.topWindowUrl.Value);
+ if (string.Equals(topWindowUri.AbsolutePath, Utilities.ApplicationRoot.AbsolutePath + "login.aspx", StringComparison.OrdinalIgnoreCase)) {
+ // this happens when the user navigates deliberately directly to login.aspx
+ Response.Redirect("~/");
+ } else {
+ Response.Redirect(this.topWindowUrl.Value);
+ }
} else {
Response.Redirect(returnUrl);
}
diff --git a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs
index 669bd24..09ed155 100644
--- a/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs
+++ b/projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs
@@ -24,14 +24,14 @@ namespace WebFormsRelyingParty.Members {
Response.Redirect("AccountInfo.aspx");
}
- this.csrfCheck.Value = Code.Utilities.SetCsrfCookie();
+ this.csrfCheck.Value = Code.SiteUtilities.SetCsrfCookie();
this.consumerNameLabel.Text = HttpUtility.HtmlEncode(OAuthServiceProvider.PendingAuthorizationConsumer.Name);
this.OAuth10ConsumerWarning.Visible = pendingRequest.IsUnsafeRequest;
this.serviceProviderDomainNameLabel.Text = HttpUtility.HtmlEncode(this.Request.Url.Host);
this.consumerDomainNameLabel3.Text = this.consumerDomainNameLabel2.Text = this.consumerDomainNameLabel1.Text = HttpUtility.HtmlEncode(OAuthServiceProvider.PendingAuthorizationConsumer.Name);
} else {
- Code.Utilities.VerifyCsrfCookie(this.csrfCheck.Value);
+ Code.SiteUtilities.VerifyCsrfCookie(this.csrfCheck.Value);
}
}
diff --git a/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj b/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj
index 3b86f6c..6d024df 100644
--- a/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj
+++ b/projecttemplates/WebFormsRelyingParty/WebFormsRelyingParty.csproj
@@ -84,7 +84,7 @@
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Code\Utilities.cs" />
+ <Compile Include="Code\SiteUtilities.cs" />
<Compile Include="Members\OAuthAuthorize.aspx.cs">
<DependentUpon>OAuthAuthorize.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>