I am trying to login Domino server. For that i am taking Lotus Notes Password and Domino Server Name from user.
if (notesPassword == "" && serverName == "")
{
MessageBox.Show("Please enter the server name !! ");
return;
}
else
{
if (connectToDomino(notesPassword, serverName))
{
MessageBox.Show("Connection Established Succesfully!!..");
}
else
{
MessageBox.Show("Connection Fail.Please Login Again To Begin");
}
}//else
and in
public bool connectToDomino(string NotesPassword, string strDominoServerName)
{
try
{
if (_lotesNotesSession == null)
{
NotesSession notesSession = new Domino.NotesSessionClass();
notesSession.Initialize(NotesPassword);
}
return true;
}
catch(Exception ex)
{
return false;
}
}
Here i am initializing notes password.So in this case it is just verifying Notes Password. So even if user enters invalid entry of server name above function will return true.
I tried :
string serverName = notesSession.ServerName;
But it is showing null value. :(
Are you targeting a specific database on the server?
I do not believe you can check that the server is valid just that the server/database combination is:
Domino.NotesSessionClass _lotesNotesSession = new Domino.NotesSessionClass();
//Initializing Lotus Notes Session
_lotesNotesSession.Initialize( "my_password" );
Domino.NotesDatabase _serverDatabase = _lotesNotesSession.GetDatabase( "some_server", "names.nsf", false );
if (_serverDatabase == null){
System.Console.Writeline("Can not connect to server.");
}