Redirect from Attribute
- by pistacchio
How can I create an attribute for an ASP.NET page that redirects to another page?
[MyAttribute()]
public partial class Default : System.Web.UI.Page
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
}
[AttributeUsage(AttributeTargets.All)]
public class MyAttribute: Attribute
{
public MyAttribute()
{
if (// something)
{
// I need to redirect to some page here
}
}
}