I have exactly the same problem. Here is my solution.
I defined an empty interface
public interface ISecurableWebObject { }
Then I defined a class that has extension methods for the interface above
public static class ISecurableWebObjectExtender { public static bool ExtensionMetotX(this ISecurableWebObject obj) { return ...; } }
I inherited ISecurableWebObject in the page classes and WebUserControl, so the definition of dublicate passed.
public partial class UcExample : System.Web.UI.UserControl, ISecurableWebObject { protected void Page_Load(object sender, EventArgs e) { if(this.ExtensionMetotX() == true) { ... } } }
Hamdi
source share