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.
https://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.”
Comments
Anonymous
August 01, 2011
rat bo ich http://ngaydem.vn http://ngaydem.com.vnAnonymous
October 01, 2013
thank you so much! http://cameraaulac.com/ http://aulacviet.vn/Anonymous
January 13, 2014
content is very interesting and meaningful to me http://cameragpc.com/Anonymous
April 22, 2014
thank you so much! http://tongdai360.com/Anonymous
May 04, 2014
content is very interesting http://seomxh.com/Anonymous
May 04, 2014
<a href="http://xudo.com.vn/" target="_new" rel="dofollow">rao vặt miễn phí</a>Anonymous
June 05, 2014
I Like content http://camerabienbac.com.vnAnonymous
July 24, 2014
great post.. http://www.apkbaru.netAnonymous
August 15, 2014
I wonder Safe Controls are different from SSL which is recently metioned that google are preffering for higher security reason. http://www.tincay.comAnonymous
September 14, 2014
lapdatcameraquansatcdc.tin.vnAnonymous
September 15, 2014
Great post http://redstarvietnam.com/Anonymous
October 16, 2014
Cong ty thiet ke nha dep: http://kienanvinh.vn Dich vu xin phep xay dung nhanh: www.xinphepxaydungnha.comAnonymous
October 22, 2014
Wow. that so good and very usefull .., http://ambike.com.vnAnonymous
October 22, 2014
Good content... http://xedapdiengiare.com.vnAnonymous
October 22, 2014
i think the article is very helpful and interesting http://xedienchinhhang.comAnonymous
November 11, 2014
I wonder Safe Controls are different from SSL which is recently metioned that google are preffering for higher security reason.Anonymous
December 27, 2014
Wow , it's great , welcome to gamevtv.com/chum-fan-art-dac-sac-chao-mung-ngay-le-noel-ngay-le-giang-sinhAnonymous
January 09, 2015
lam bang dai hoc tai Ha noi lambangdaihochanoigiare.blogspot.com lam bang dai hoc tai TPHCM lambangdaihochanoitphcm.blogspot.comAnonymous
January 09, 2015
lam bang dai hoc tai Ha Noi lambangdaihochanoigiare.blogspot.com lam bang dai hoc tai TPHCM lambangdaihochanoitphcm.blogspot.comAnonymous
January 18, 2015
Great ! Thank you for sharing...thangmayphuongdong.com.vnAnonymous
January 18, 2015
Kien truc nha viet: http://www.kientrucnhaviet.net Dich vu xin giay phep xay dung: www.dichvuxinphepxaydung.netAnonymous
February 13, 2015
I wonder Safe Controls are different from SSL which is recently metioned that google are preffering for higher security reason. www.kenhchungcuhanoi.com ThanksAnonymous
March 01, 2015
i think the article is very helpful and interesting , thanks for postingAnonymous
May 08, 2015
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: www.facebook.com/lephuonghai Website: www.phantichcophieu.info Email: lephuonghai107@gmail.comAnonymous
May 24, 2015
thanks for your verry useful infomation http://tapchiseo.info/Anonymous
June 03, 2015
Like post http://toiden.npfood.com.vn/Anonymous
June 08, 2015
good jobs http://quattrandep.vn/ http://bepanthinh.com/Anonymous
June 29, 2015
The comment has been removedAnonymous
July 02, 2015
Some of my pages also similar cases occur . However , this treatment but not too difficult . http://imperiagarden.co and : http://tronven.vnAnonymous
July 02, 2015
The comment has been removedAnonymous
July 02, 2015
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 . www.chevrolet-thanglong.vnAnonymous
August 18, 2015
lupa mau blng ap, cba aj lg gan ya mdah2an bsa d postAnonymous
September 03, 2015
informasi yang sangat bermanfaat sekali buat para pembaca seperti saya nice share :D salam http://indexapk.net | http://www.aan.my.idAnonymous
October 10, 2015
The comment has been removedAnonymous
November 23, 2015
i think the article is very helpful and interesting chungcuhn24h.net/chung-cu-60b-nguyen-huy-tuong-gia-goc-cdtAnonymous
December 12, 2015
laptop giá rẻ tại : http://laptopre.vn/Anonymous
February 04, 2016
The Vesta nhà ở xã hội,chất lượng thương mại http://canhothevesta.net http://dreamhouses.info