I have observed the code snippet shared by you and like to share that you are missing option for setting header footer visibility to true. Please visit this link for your further reference.
Please share the working sample code that you have used to reproduce the issue. I will investigate the issue on my end. Please try the latest version of Aspose.Slides for .NET 5.9.0.
Please use the code snippet shared below for your kind reference. The following code works for me. Please share, if I may help you further in this regard.
Dim ppt As Presentation = New Presentation(“C:\Users\Mudassir\Downloads\Apresentation.ppt”)
’ For Each item As DictionaryEntry In htVarConf
For Each pSlide As Slide In ppt.Slides
For Each shp As Shape In pSlide.Shapes
If (shp.TextFrame.Text.Contains("##TitDoc")) Then
shp.TextFrame.Paragraphs(0).Text = “Text Changed”
End If
Next
Dim mas As Slide = ppt.GetSlideById(pSlide.MasterId)