cancel
Showing results for 
Search instead for 
Did you mean: 

How to re login after a failed login

Former Member
0 Kudos

Using .Net Connector 3.0\Compiled with .NET Framework 2.0 and MS Visual Studio 2008, C#

Hello All,

I created an application where the user can input SAP user name and password in a dialog. Then it connects to SAP and executing some RFC. Working fine.

When the user put in a wrong SAP username or password I get an exception. OK.

But what do I have to do, to let him login again with the correct username and password.

Here is my coding:

IDestinationConfiguration config = new myBackendConfig(); // provides all connection parameters including user/pwd

RfcDestination prd = RfcDestinationManager.GetDestination(config.GetParameters(connId));

RfcRepository repo = prd.Repository;

When I call this second time with correct user/password, then the prd.Repository will run into an exception with message:

"Der Wert darf nicht NULL sein.\nParametername: key" (german)

My translation: "Value must not be NULL.\nParameter name: key".

Any help would be appreciated!

Regards,

Peter

Accepted Solutions (0)

Answers (2)

Answers (2)

ingo_frank2
Discoverer
0 Kudos

Hello Peter,

I was struggling with the same issue.

NCo provides an delegate for handling change events: RfcDestinationManager.ConfigurationChangeHandler. But I found no documentation about this and could'n get it running.

Here is my workaround:

For destination configuration use the way as described in NCo_30_Overview.pdf (page 7 and 8).

If the compiler warns you, that the event is never used, just add the following line to MyBackendConfig:

private void ConfigurationChangedEventDummyCall() { ConfigurationChanged(null, null); }

Change your coding as follows:

IDestinationConfiguration config = new MyBackendConfig();

RfcDestinationManager.RegisterDestinationConfiguration(config);

RfcDestination prd = RfcDestinationManager.GetDestination("PRD_000");

before you try to get the Repository, execute a Ping and catch the Exception:

try...

prd.Ping();

This prevents you from getting the "Der Wert darf nicht NULL sein" error on the second call.

If Ping fails, unregister the configuration, change username and/or password, create a new config and register again.

catch...

RfcDestinationManager.UnregisterDestinationConfiguration(config);

// change config here... (prompt for username / password)

config = new MyBackendConfig();

RfcDestinationManager.RegisterDestinationConfiguration(config);

RfcDestination prd = RfcDestinationManager.GetDestination("PRD_000");

again

prd.Ping();

If the second ping is working, logon was ok and you can continue and get the Repository without an error.

Regards,

Ingo

Edited by: Ingo Frank on Sep 19, 2011 4:24 PM

madhu_vadlamani
Active Contributor
0 Kudos

Hi Peter,

In standard it wont lock for the first time.You means is not allowing to login again.

Regards,

Madhu.

Former Member
0 Kudos

I'm stuck into this error too. Waited for 4 hours but still getting same error.

Any help will be appreciated.

madhu_vadlamani
Active Contributor
0 Kudos

Hi Peter,

In general it wont take that much time re login.Even i am using but it is not taking that much time.

Regards,

Madhu.