Help with photodiode?

hii i am working on a circuit where i want to use photo diode as a switch.. that is when infra red radiation falls on the photo diode, it will allow the current to flow through the remaining circuit. but when i did the circuit, there was a small problem. even if ir led is not used, small current is passing through the remaining circuit. how can i stop this. how can i make it in such a way that no current will flow through the photo diode unless ir rays are allowed to fall on the photo diode...
thanks in advance..

This sounds to me like the age-old problem of separating signal from noise.

You say some current is flowing through the photodiode both when it is illuminated by an IR LED, and when it is not.

Thus the mere presence of current flowing through the photodiode is not what you want your circuit to respond to.

Presumably there will be more current flowing through the photodiode when it is illuminated by the IR LED, and less current when it is not.

So the naive way to do this is to just build a comparator,
one that turns on when photodiode current rises above some threshold value, and turns off when the photodiode current falls below the same threshold value.

And that trick will work, in the case where there the amount of IR  light hitting the photodiode is large, e.g. in a case where the IR LED and the photodiode are separated by a distance of just a few centimeters.  In this case the difference between the dark photodiode current, and the illuminated photodiode current, is large and easy to detect.

However if the IR LED and photodiode are separated by a distance of just a few meters (a typical distance between a TV remote and the TV), the signal level, the actual difference in photodiode current caused by the IR illumination, this signal level becomes very small, to small for the old comparator trick to work reliably.

So in that case, for sending the signal across the room,  other tricks are required: modulation, demodulation, amplification (gain), and automatic gain control (AGC). 

Fortunately, the use of IR remotes for televisions, etc, is so ubiquitous that if you want to send your IR signal over a distance of more than just a centimeter or so, the easiest way to do this would be to just use one of those IR receiver modules.  Such a module contains a photodiode, plus the demodulator, plus the amplifier and AGC, all in one tiny, and cheap, little package.  A typical IR reciever module has 3 pins, {+5V, ground, and signal out}, and you can see some pictures of what they look like, here:

Anyway, to summarize all this:  If you intend to send your IR signal over just a few cm or so, e.g. for a photogate, or a proximity sensor, or something similar, then you can just use a simple comparator, or a comparator with hysteresis, and that will work.

However if you want to send your IR signal several meters, e.g. from one side of the room to the other, then you should try using one of those cheap IR receiver modules, together with a discarded IR remote control to use as the transmitter.

Use an IR sensitive photodiode, or put an IR filter over the diode.

You need to specify WHAT IR wavelength you wish to pass.