void customWriter_WritingAttribute(object sender, SubstituteValueEventArgs e) { if (e.Name == "action") { //use action attribute only if one is explicitly provided if (action != null) { e.NewValue = action; } else if (removeAction == true) { e.Cancel = true; } else { e.NewValue = Context.Request.RawUrl; } } }
public override void WriteAttribute(string name, string value, bool fEncode) { string valToWrite = value; SubstituteValueEventArgs args = new SubstituteValueEventArgs(name, value); if (WritingAttribute != null) { WritingAttribute(this, args); if (args.Cancel == false) { valToWrite = args.NewValue; } } if (args.Cancel == false) { base.WriteAttribute(name, valToWrite, fEncode); } }