Hi pranam77,
I made this several time, and this is working in industrial conditions without problem.
Whole idea is to put alternate current via water. In this case water is conductor, but alternate current kill electrolysis effect.
I use transformer 220VAC/12VAC, one secondary pin connect to one ~ graetz pin, another secondary pin connect to another ~ graetz pin via water (two wire are level senzors).
+ and - from graetz connect via resistor to diode in optocoupler. On transistor side of optocoupler you will get some trapezoidal signal when water touching both wires, in other case signal is 0.
Only trick is that current via water has to be around 1mA (in that case electrolysis effect is 0).
Hope this helps.
Mr.Cube