Pluck out the actual LDAP code into IRB and see if it works. I've not
had experience passing Net::LDAP.new a hash, I've only ever assigned
values to its attributes after creating the instance, like:

ldap = Net::LDAP.net
ldap.host = 'http://localhost/
ldap.auth "%s@localhost" % user, pass
ldap.bind

Try that if your way fails in IRB.

Matt Todd



On Jan 17, 2008 8:34 AM, Varun Goel <varun.rajeshkumar / gmail.com> wrote:
> hi all i made authentication function like this
> require 'net/ldap'
>
> module LDAP
>
>   def self.authenticate(user,password)
>   puts user
>     if user == "" || password == ""
>       return false
>     end
>     ldap_con = Net::LDAP.new({:host => '192.168.0.3',
>       :auth=>{:method=>:simple,:username => user,
>       :password => password } } )
>     return true if ldap_con.bind
>     return false
>   end
> end
> But when i send user name and password from rhtml page it's shows error
> like
> No connection to server
> Please help me out.
> Thanks
> Varun
> --
> Posted via http://www.ruby-forum.com/.
>
>