Author: igorz
Date: 2007-02-26 04:59:57 -0500 (Mon, 26 Feb 2007)
New Revision: 73418
Modified:
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI.WebControls/Login.cs
Log:
2007-02-26 Igor Zelmanovich <[EMAIL PROTECTED]>
* Login.cs: fixed:
considers FormsAuthentication.ReturnUrl only if is placed in
the login page defined in web.config.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-02-26 09:43:16 UTC (rev 73417)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
2007-02-26 09:59:57 UTC (rev 73418)
@@ -1,3 +1,9 @@
+2007-02-26 Igor Zelmanovich <[EMAIL PROTECTED]>
+
+ * Login.cs: fixed:
+ considers FormsAuthentication.ReturnUrl only if is placed in
+ the login page defined in web.config.
+
2007-02-23 Marek Habersack <[EMAIL PROTECTED]>
* ObjectDataSourceView.cs: Fix saving/restoring the view state.
Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/Login.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/Login.cs
2007-02-26 09:43:16 UTC (rev 73417)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/Login.cs
2007-02-26 09:59:57 UTC (rev 73418)
@@ -1272,19 +1272,25 @@
OnLoggedIn (EventArgs.Empty);
string url = DestinationPageUrl;
- if (Page.Request.Path.ToLower ().StartsWith
(FormsAuthentication.LoginUrl.ToLower ()) &&
- FormsAuthentication.ReturnUrl != null
&&
- FormsAuthentication.ReturnUrl.Length >
0)
- Redirect
(FormsAuthentication.ReturnUrl);
- if (url.Length == 0 &&
FormsAuthentication.DefaultUrl != null)
- url = FormsAuthentication.DefaultUrl;
- if (url.Length == 0) {
- Redirect (FormsAuthentication.LoginUrl);
- } else {
+ if (Page.Request.Path.ToLower ().StartsWith
(FormsAuthentication.LoginUrl.ToLower ())) {
+ if (!String.IsNullOrEmpty
(FormsAuthentication.ReturnUrl))
+ Redirect
(FormsAuthentication.ReturnUrl);
+ else if (!String.IsNullOrEmpty
(DestinationPageUrl))
+ Redirect (url);
+ else if (!String.IsNullOrEmpty
(FormsAuthentication.DefaultUrl))
+ Redirect
(FormsAuthentication.DefaultUrl);
+ else if (url.Length == 0)
+ Refresh ();
+ }
+ else if (!String.IsNullOrEmpty
(DestinationPageUrl)) {
Redirect (url);
}
+ else {
+ Refresh ();
+ }
return true;
- } else {
+ }
+ else {
OnLoginError (EventArgs.Empty);
if (FailureAction ==
LoginFailureAction.RedirectToLoginPage) {
// login page is defined in web.config
@@ -1326,6 +1332,11 @@
if ((Page != null) && (Page.Response != null))
Page.Response.Redirect (url);
}
+
+ private void Refresh () {
+ if ((Page != null) && (Page.Response != null))
+ Page.Response.Redirect (Page.Request.RawUrl);
+ }
private void UserName_TextChanged (object sender, EventArgs e)
{
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches