Why is my control working even though I don’t have a SafeControl entry?


This one came as a surprise to me.  Customer pushes out a master page to all their site collections using a solution and feature.  The master page has a server control that renders some information, so the control should have a SafeControl entry in the web.config file.  Oddly enough, the sites render using the master page, including the server control, without any issues…and there is not a SafeControl entry for the control in the config file.

As it turns out, SharePoint only uses the SafeControl entries when rendering customized pages.  When the master page is deployed using the solution and a feature, the file is uncustomized at that point, and the control will render just fine.  Once you touch the page with SharePoint Designer, or in this case use export/import on a site, the master page gets customized and the SafeControl entries are in play, resulting in the site failing to render.  Here’s some documentation for your perusal, highlighting was added to point out the important bits.

http://msdn.microsoft.com/en-us/library/bb964680.aspx

“Safe Controls

Safe mode processing goes a step beyond protecting against in-line script by also considering what controls a user might place on a customized page. For example, imagine a scenario in which a site administrator tries to mount an attack by adding a server-side control to a site page and parameterizing it in a certain way. Safe mode allows the farm administrator to determine which controls can be used in pages that are processed in safe mode.

Customized pages can only contain server-side controls that are explicitly registered as safe controls. Registering a control as a safe control is accomplished by adding a SafeControl entry into the web.config file for the hosting Web application.”

 

Just for completeness, here’s the error and a screenshot of what you get when the SafeControl entry is missing.

“The base type ‘TestControl.DemoMaster’ is not allowed for this page. The type is not registered as safe.”

image

Comments (37)
  1. camera Gia Phát says:

    content is very interesting and meaningful to me

    http://cameragpc.com/

  2. tong dai says:

    thank you so much!

    http://tongdai360.com/

  3. tong dai says:

    content is very interesting http://seomxh.com/

  4. SEO Mxh says:

    <a href="http://xudo.com.vn/&quot; target="_new" rel="dofollow">rao vặt miễn phí</a>

  5. camerabienbac says:

    I Like content

    http://camerabienbac.com.vn

  6. TinCay says:

    I wonder Safe Controls are different from SSL which is recently metioned that google are preffering for higher security reason.

    http://www.tincay.com

  7. kavpro says:

    Cong ty thiet ke nha dep: http://kienanvinh.vn

    Dich vu xin phep xay dung nhanh: http://www.xinphepxaydungnha.com

  8. Phamminhquan says:

    Wow. that so good and very usefull .., http://ambike.com.vn

  9. ThanChuoi says:

    i think the article is very helpful and interesting

    http://xedienchinhhang.com

  10. sua cua cuon says:

    I wonder Safe Controls are different from SSL which is recently metioned that google are preffering for higher security reason.

  11. lam bang dai hoc says:

    lam bang dai hoc tai Ha noi lambangdaihochanoigiare.blogspot.com

    lam bang dai hoc tai TPHCM lambangdaihochanoitphcm.blogspot.com

  12. Phan Quang says:

    lam bang dai hoc tai Ha Noi lambangdaihochanoigiare.blogspot.com

    lam bang dai hoc tai TPHCM lambangdaihochanoitphcm.blogspot.com

  13. Enzoleo says:

    Great ! Thank you for sharing…thangmayphuongdong.com.vn

  14. kientrucpro says:

    Kien truc nha viet: http://www.kientrucnhaviet.net

    Dich vu xin giay phep xay dung: http://www.dichvuxinphepxaydung.net

  15. Kenhchungcuhanoi says:

    I wonder Safe Controls are different from SSL which is recently metioned that google are preffering for higher security reason.

    http://www.kenhchungcuhanoi.com

    Thanks

  16. viettimetravel says:

    i think the article is very helpful and interesting , thanks for posting

  17. http://www.phantichcophieu.info/ says:

    Mở tài khoản chứng khoán tận nơi – Trích phí giao dịch 100%

    Cung cấp cho khách hàng

    File excel quản lý danh mục đầu tư chứng khoán

    Liên hệ: Hải Canslim

    MBA- Finance, University of Chester

    CFA Level 3 – CMT Level 3 – CAT Level 3

    Facebook: http://www.facebook.com/lephuonghai

    Website: http://www.phantichcophieu.info

    Email: lephuonghai107@gmail.com

  18. Blue says:

    thanks for your verry useful infomation

    http://tapchiseo.info/

  19. Long Ruoi says:

    Some of my pages also similar cases occur .

    However , this treatment but not too difficult .

    http://imperiagarden.co

    and : http://tronven.vn

  20. Gold Lixil says:

    Visit 3 floors showcase the best form of Showroom bathroom GDR – Gold LIXIL 181 Truong Chinh .

    http://inaxchinhhieu.com

  21. Quan Luong says:

    Thanks : Chevrolet Thang Long the Authorised Dealers CHEVROLET level 1 in Hanoi . CHEVROLET SPARK has confirmed the brand worldwide . Currently, due to market demand Chevrolet Thang Long VIETNAM .

    http://www.chevrolet-thanglong.vn

  22. redi benzema says:

    lupa mau blng ap, cba aj lg gan ya mdah2an bsa d post

  23. aan says:

    informasi yang sangat bermanfaat sekali buat para pembaca seperti saya

    nice share 😀

    salam

    http://indexapk.net | http://www.aan.my.id

  24. chungcuhn says:

    i think the article is very helpful and interesting

    chungcuhn24h.net/chung-cu-60b-nguyen-huy-tuong-gia-goc-cdt

  25. laptopre.vn says:

    laptop giá rẻ tại : http://laptopre.vn/

  26. The Vesta says:

    The Vesta nhà ở xã hội,chất lượng thương mại

    http://canhothevesta.net

    http://dreamhouses.info

Comments are closed.

Skip to main content