Implement the SuppressFormsAuthenticationRedirect properties
authorMartin Thwaites <github@my2cents.co.uk>
Sun, 26 Oct 2014 14:29:45 +0000 (14:29 +0000)
committerMartin Thwaites <github@my2cents.co.uk>
Sun, 26 Oct 2014 14:55:41 +0000 (14:55 +0000)
mcs/class/System.Web.Abstractions/System.Web/HttpResponseBase.cs
mcs/class/System.Web.Abstractions/System.Web/HttpResponseWrapper.cs
mcs/class/System.Web/System.Web.Security/FormsAuthenticationModule.cs
mcs/class/System.Web/System.Web/HttpResponse.cs

index 0a3aa6694dd392a73ce18b7fa3b90133822cc49b..921ace9ea843e78321ab1d21c19f8bb476188dec 100644 (file)
@@ -105,6 +105,10 @@ namespace System.Web
 
                public virtual bool SuppressContent { get { NotImplemented (); return false; } set { NotImplemented (); } }
 
+#if NET_4_5
+               public virtual bool SuppressFormsAuthenticationRedirect { get { NotImplemented (); return false; } set { NotImplemented (); } }
+#endif
+
                public virtual bool TrySkipIisCustomErrors { get { NotImplemented (); return false; } set { NotImplemented (); } }
 
 
index eed3415cd1c1319b711c9a4e8bdadc7e5d7a09c4..1d9c20781719eca5fafb0470f0ca2a40e50bb5e8 100644 (file)
@@ -169,6 +169,13 @@ namespace System.Web
                        set { w.SuppressContent = value; }
                }
 
+#if NET_4_5
+               public override bool SuppressFormsAuthenticationRedirect {
+                       get { return w.SuppressFormsAuthenticationRedirect; }
+                       set { w.SuppressFormsAuthenticationRedirect = value; }
+               }
+#endif
+
                public override bool TrySkipIisCustomErrors {
                        get { return w.TrySkipIisCustomErrors; }
                        set { w.TrySkipIisCustomErrors = value; }
index cab57fea2f2ff83ab4b858d4e5947ac9b7c4d058..54f07294e288065497427146caf1e1577fbbee1b 100644 (file)
@@ -180,6 +180,11 @@ namespace System.Web.Security
                        if (context.Response.StatusCode != 401 || context.Request.QueryString ["ReturnUrl"] != null)
                                return;
 
+#if NET_4_5
+                       if (context.Response.StatusCode == 401 && context.Response.SuppressFormsAuthenticationRedirect)
+                               return;
+#endif
+
                        string loginPage;
                        InitConfig (context);
 #if NET_2_0
index 65718e5cd9bc41494cc3ec01bc9f2e62c8d39309..4bd3380a8f856e32a4cf7fea7fc13886ce43bea7 100644 (file)
@@ -400,6 +400,13 @@ namespace System.Web
                        set;
                }
 
+#if NET_4_5
+               public bool SuppressFormsAuthenticationRedirect {
+                       get;
+                       set;
+               }
+#endif
+
                public bool TrySkipIisCustomErrors {
                        get;
                        set;