Click here to Skip to main content
14,668,844 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am trying to connect to postgresql databse through asp.net but getting this error again and again even after writing code correctly. Can anyone please help me out with the solution here is my code? :-

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As NpgsqlConnection
con = New NpgsqlConnection("server=localhost;port=5432;userid=mayank;password=manager;database=postgres")
con.Open()
MsgBox("opened")

End Sub

Error that i am getting is :-

Could not load file or assembly 'Mono.Security, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have added monosecurity.dll as refernce yet not getting connected to postgresql db...m using npgsql driver to connect to postgresql database
Posted
Updated 20-Aug-15 0:02am
v2
Comments
Afzaal Ahmad Zeeshan 20-Aug-15 5:58am
   
The assembly Mono.Security with that (exact) version is not found. Make sure it is present in your references or bin folder.
manika21 20-Aug-15 7:45am
   
m using .net frmwork 4 so monosecirity will also be of 4th version to be downloaded afzaal?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You must use the Mono.Security.dll file that comes with the Novell.Directory.Ldap.dll you downloaded, otherwise you;ll run into binary compatibility issue.

Note that the version number of Mono.Security.dll match the framework version since this assembly is part of the Mono framework where it is used by most of its security tools. As such you cannot go around and look for the file (well you could be lucky, but don't count on it) you need the one that was used to test Novell.Directory.Ldap.dll.
   
Comments
manika21 20-Aug-15 6:57am
   
thanks for replyin abhishek but how could i do as u said can u explain that file to be downloaded with steps
Thanks
manika21 20-Aug-15 7:01am
   
i got same answere wheni searched n followed as well but no monosecurity file comes along with Novell.Directory.Ldap.dll. .... or else i have to add referense of monosecurity with Novell.Directory.Ldap.dll. in my psroject if it is so ...then i did that as well but not ablec to connect plz reply its v urgent....
Abhishek Kumar Goswami 20-Aug-15 7:08am
   
https://www.novell.com/documentation/developer/ldapcsharp/?page=/documentation/developer/ldapcsharp/cnet/data/bovtuda.html

check this , i guess might be helpful.
manika21 20-Aug-15 7:15am
   
i exactly went through the same buddy but m using vb.net not c# if it comes to language
by the way ...that link only consist of Novell.Directory.Ldap.dll. file not monosecurity.dll file...here i got confused since v need to add monosecurity comes from
Novell.Directory.Ldap.dll. but nothing as such

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100