Desorption/ionization on silicon (DIOS) mass spectra of model ionic dyes methylene blue (MB+Cl-) and methyl orange (Na+MO-) were studied using p+ type-derived porous silicon (PS) free layers. As-prepared PS (PS-H), the PS thermally oxidized at 300 degrees C (PS-OX), PS with chemically grafted cation-exchanging alkylsulfonic acid (PS-SO(3)H) and anion-exchanging propyl-octadecyldimethylammonium chloride (PS-ODMA+Cl-) groups was tested as ionization platforms. Two mechanisms of the methylene blue desorption/ionization were found: (1) the formation of [MB + H]+* ion due to the reduction/protonation of MB+, which is predominant for PS-H and PS-OX platforms and (2) direct thermal desorption of the MB+ cation, prevailing for PS-SO3H. The fragmentation of the cation is significantly suppressed in the latter case. The samples of PS-SO3H and PS-ODMA+ Cl- efficiently adsorb the dyes of the opposite charge from their solutions via the ion-exchange. Consequent DIOS MS studies allow to detect only low fragmented ions (MB+ and MO-, respectively), demonstrating the potential of the ion-exchange adsorption combined with DIOS MS for the analysis of ionic organic compounds in solutions.