2006-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 8 Sep 2006 19:08:53 +0000 (19:08 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 8 Sep 2006 19:08:53 +0000 (19:08 -0000)
* Login.cs: fix problem with the login control and master pages.
Patch by Marek Habersack that fixes bug #78219.

svn path=/trunk/mcs/; revision=65127

mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
mcs/class/System.Web/System.Web.UI.WebControls/Login.cs

index 89265acb48167a8dd7cd9cbaba64a88909c556df..cea19b6a3ae0ae8afd8dd9cb46c80955522913be 100644 (file)
@@ -1,3 +1,8 @@
+2006-09-08 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * Login.cs: fix problem with the login control and master pages.
+       Patch by Marek Habersack that fixes bug #78219.
+
 2006-09-07 Igor Zelmanovich <igorz@mainsoft.com>
 
        * TreeView.cs: fixed: populating nodes.
index 87bac0238aaf006d1cd02634e299dde287218c92..e9bfdfa9194fae3d2bc0e31e9c1e9ec77175a234 100644 (file)
@@ -1296,8 +1296,13 @@ namespace System.Web.UI.WebControls {
                        OnAuthenticate (aea);
 
                        if (aea.Authenticated) {
+                               FormsAuthentication.SetAuthCookie (UserName, RememberMeSet);                            
+
                                string url = DestinationPageUrl;
-                               FormsAuthentication.SetAuthCookie (UserName, RememberMeSet);
+                               if (url.Length == 0 && Page.Request.UrlReferrer != null)
+                                       url = Page.Request.UrlReferrer.ToString();
+                               if (url.Length == 0 && FormsAuthentication.DefaultUrl != null)
+                                       url = FormsAuthentication.DefaultUrl;
                                if (url.Length == 0) {
                                        Redirect (FormsAuthentication.LoginUrl);
                                } else {
@@ -1334,8 +1339,10 @@ namespace System.Web.UI.WebControls {
                {
                        if ((Page == null) || (Page.Request == null))
                                return false;
-                       string url = Page.Request.Url.AbsolutePath;
                        string defaultLogin = FormsAuthentication.LoginUrl;
+                       if (defaultLogin == null)
+                               return false;
+                       string url = Page.Request.Url.AbsolutePath;
                        return (String.Compare (defaultLogin, 0, url, url.Length - defaultLogin.Length, defaultLogin.Length,
                                true, CultureInfo.InvariantCulture) == 0);
                }