@@ -659,7 +659,7 @@ private static void AddImageHandlers(string siteName)
659659 bool pngHandlerMissing = true ;
660660 bool jpgHandlerMissing = true ;
661661 bool jpegHandlerMissing = true ;
662- // ConfigurationElement toRemoveCe;
662+ ConfigurationElement toRemoveCe = null ;
663663
664664 foreach ( ConfigurationElement ce in handlersCollection )
665665 {
@@ -680,7 +680,8 @@ private static void AddImageHandlers(string siteName)
680680 }
681681 if ( ce . GetAttributeValue ( "name" ) . ToString ( ) == "ExtensionlessUrlHandler-Integrated-4.0" )
682682 {
683- handlersCollection . Remove ( ce ) ;
683+ toRemoveCe = ce ;
684+ //handlersCollection.Remove(ce);
684685 }
685686 //string obj = "";
686687 //foreach (var part in ce.Attributes)
@@ -695,25 +696,27 @@ private static void AddImageHandlers(string siteName)
695696 try
696697 {
697698 ConfigurationElement configurationElementpng = handlersCollection . CreateElement ( "add" ) ;
698- // MessageBox.Show("pngHandlerMissing 1");
699+ MessageBox . Show ( "pngHandlerMissing 1" ) ;
699700 configurationElementpng [ "name" ] = "get-image-png" ;
700- // MessageBox.Show("pngHandlerMissing 2");
701+ MessageBox . Show ( "pngHandlerMissing 2" ) ;
701702 configurationElementpng [ "path" ] = @"*.png" ;
702- // MessageBox.Show("pngHandlerMissing 3");
703+ MessageBox . Show ( "pngHandlerMissing 3" ) ;
703704 configurationElementpng [ "verb" ] = "GET" ;
704- // MessageBox.Show("pngHandlerMissing 4");
705+ MessageBox . Show ( "pngHandlerMissing 4" ) ;
705706 configurationElementpng [ "type" ] = @"System.Web.Handlers.TransferRequestHandler" ;
706- // MessageBox.Show("pngHandlerMissing 5");
707+ MessageBox . Show ( "pngHandlerMissing 5" ) ;
707708 configurationElementpng [ "preCondition" ] = "integratedMode,runtimeVersionv4.0" ;
708- // MessageBox.Show("pngHandlerMissing 6");
709+ MessageBox . Show ( "pngHandlerMissing 6" ) ;
709710 configurationElementpng [ "responseBufferLimit" ] = 0 ;
710- // MessageBox.Show("pngHandlerMissing 7");
711+ MessageBox . Show ( "pngHandlerMissing 7" ) ;
711712 string obj = "" ;
712713 foreach ( var part in configurationElementpng . Attributes )
713714 {
714715 obj += part . Name + " : " + part . Value + "\n " ;
715716 }
716717 //MessageBox.Show("configurationElementpng is " + obj.ToString());
718+
719+ handlersCollection . Remove ( toRemoveCe ) ;
717720 handlersCollection . Add ( configurationElementpng ) ;
718721 } catch ( Exception ex )
719722 {
0 commit comments