Guest User

Untitled

a guest
Feb 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. var pageHandler = this.ViewContext.HttpContext.Handler.GetPageHandler();
  2. foreach (var c in pageHandler.Header.Controls)
  3. {
  4. if (c != null && c is System.Web.UI.HtmlControls.HtmlLink)
  5. {
  6. System.Web.UI.HtmlControls.HtmlLink mylink = (System.Web.UI.HtmlControls.HtmlLink)c;
  7. if (mylink.Attributes["rel"] == "canonical")
  8. {
  9. pageHandler.Header.Controls.Remove(mylink);
  10. }
  11. }
  12. }
Add Comment
Please, Sign In to add comment