You are viewing limited content. For full access, please sign in.

Question

Question

Using SDK .net to Close/Terminate a Session

asked on December 27, 2019

Hello,

I have a issue with my import program not closing or terminating my session after it imports a document.  I am passing the program all the parameters of where to store the documents, then I go and grab the next document and repeat until I finish the documents for the day.  Each document creates a new session but the other sessions aren't closing/terminating.  I have tried the following but none of these are working.

    Repository.TerminateSession(RASess.ID,RASess)
    RASess.LogOut()
    RASess.Discard()
    RASess.Close()

 

Is there something else to try?  I need to find a way to run my program without filling up the sessions.

Thanks,

Gary Schreader

0 0

Replies

replied on December 27, 2019

LogOut/Close should do the trick. Maybe your code is throwing an exception and bypassing these calls? The safest method is to wrap your code in a using block, so the session is closed even when an exception is thrown:

using (Session RASess = LogIn())
{
    // Perform your work here
}
// The session will be closed at this point, even when an exception is thrown.

 

3 0
replied on December 27, 2019

Robert,

Thank you for your help.  That worked great.  I ran through 20 seperate document imports, they all imported as expected and when I checked after it completed I had 0 sessions left open.

Thanks,

Gary Schreader

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.