Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Worksite SDK - How can I add multiple ImanSession objects to a shared ManDMS object?
alex_abell
Hi All,
I am currently enhancing a web application which allows users to login into our document management system. Currently, during login a new ManDMS object is created for each user but according to the Worksite 8.2 reference manual and I quote:
"Note: Do not create more than one IManDMS object per application. You may have
multiple pointers, however, to the same IManDMS object."
I want to enhance the application so that each user shares the same ManDMS object but it seemd that the SDK prevents me from doing so. Each user of the application will login into the same DM server. Therefore, when creating a new session object, I add to the sessions collection as instructed:
Dim ImanSessionObj1 as ImanSession= ManDMS.Sessions.Add("DMServer")
I can log this session in fine. However, when I wish to create a session for another user
Dim ImanSessionObj2 as ImanSession= ManDMS.Sessions.Add("DMServer")
Obviously I get an error because the servername is not unique
[Sessions ][Add ]Item "DMServer" already exists in the collection
Am I missing something here? Is there a way to create two sessions within a ManDMS object that use the same DM Server or will I have to stick to the original method of creating a ManDMS object for each user?
Any help you can give me would be much appreciated.
Many thanks,
Alex
Find more posts tagged with
Comments
Migrateduser
Alex,
you need to store your DMs object in a session and also use SmartDMS.
I have build a custom web app which connects to multiple servers for a single user and it works fine with SmartDMS object
Thanks
Sheetal
Worksite/SharePoint consultant
www.docstree.com
sheetal@docstree.com
alex_abell
Hi Sheetal,
Many thanks for your response. I am already storing my DMS object in a session and I am already able to connect a single user to different DM servers. My problem is that I want to connect many users to one DM server but the only way I am able to do this is by creating a DMS object for each user rather than having one DMS object with many users connecting to the DM server via it.
Also, what is Smart DMS? What API is this object part of? I am using the Worksite 8.2 API.
Thanks,
Alex
Migrateduser
Alex,
How many users do you want to connect to a single DMS ? In a single session object, you can only add one server - You may need different DMS instance (different names) and store it that way?
What is purpose of having multiple users logged in in the same session ? If its a web app, wouldnt it make more sense to have a seperate session for each users?
The SmartDMS is just another object class (just a wrapper around NRTDMS object) which was design to do a better thread management in the web environment.
Thanks
Sheetal
Worksite/SharePoint consultant
www.docstree.com
sheetal@docstree.com
alex_abell
Sheetal,
I am unsure of an exact number of users who will using my web application. It could be between 1 and 50 simultaneously and I want to connect them all to one DM server via 1 ManDMS object.
I already have a working web application but currently, for every user that logs in, a new ImanSession object and a new ManDMS object is created. This all works correctly but I am trying to streamline the application. In the COM reference manual under the ManDMS item it says
"Note: Do not create more than one IManDMS object per application. You may have multiple pointers, however, to the same IManDMS object."
Therefore, for every user that logs into my application I should be able to create individual ImanSession objects using one shared ManDMS object. However, because for some reason the ImanSessions collection within the ManDMS object uses the server name as the unique index for each ImanSession object, I cannot add more than one ImanSession object that connects to the same DM server to the collection. This doesn't make any sense to me.
I have found the SmartNRTDMS object you mentioned in a previous post though. I attempted to use it to solve the problem but I get the same error when I add my second user logs in - [Sessions ][Add ]Item "DMSERVER1" already exists in the collection.
Your help is much appreciated!
Alex
Migrateduser
It doesn't make sense. Could you post detail code snippet including how you store the DMS object into the ASP Session.
The SmartDMS is exactly designed to avoid threading issues with multiple users. You should be use SMartDMs.DMS Object. Are you creating them as a private variable and then storing it in ASP.NET. You could also create a wraper .NET class and store that entire class into ASP.NEt session
Thanks
Sheetal
alex_abell
Hi Sheetal,
Here is the code I have written to connect many users to one DMS. I store the SmartNRTDMS object in the application cache so it is available globally. For each user that attempts to login into my application, I use the SmartNRTDMS object in cache and attempt to add a new session to it using the same DM Server using the PerformLogin sub routine. It is at this point the login fails stating [Sessions ][Add ]Item "DMSERVER1" already exists in the collection. I hope this makes sense. Let me know if you need any more information.
Alex
Public Shared ReadOnly Property SmartNRTDMS() As SmartNRTDms
Get
If Not Current.Cache.Item("SmartNRTDms") Is Nothing Then
Return Current.Cache.Item("SmartNRTDms")
Else
Try
Dim tmpDMS As SmartNRTDms = Nothing
tmpDMS = New SmartNRTDms
tmpDMS.NRTDMS.ComputerName = BBConfiguration.DMServer
DirectCast(tmpDMS.NRTDMS, ManDMS).ApplicationName = BBConfiguration.ApplicationName
Current.Cache.Add("SmartNRTDms", tmpDMS, Nothing, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(BBConfiguration.SessionTimeout), CacheItemPriority.High, Nothing)
Return Current.Cache.Item("SmartNRTDms")
Catch ex As Exception
Return Nothing
End Try
End If
End Get
End Property
Public Shared Property ImanSession() As IManSession
Get
If (GetSessionValue("ImanSession") Is Nothing) Then
Return Nothing
Else
Return GetSessionValue("ImanSession")
End If
End Get
Set(ByVal value As IManSession)
SetSessionValue("ImanSession", value)
End Set
End Property
Public Shared Sub PerformLogin()
Try
If SmartNRTDMS.NRTDMS.Sessions.Count = 0 Then
ImanSession = SmartNRTDMS.NRTDMS.Sessions.Add(BBConfiguration.DMServer)
Else
ImanSession = SmartNRTDMS.NRTDMS.Sessions.Add(BBConfiguration.DMServer, Nothing, SmartNRTDMS.NRTDMS.Sessions.Item(SmartNRTDMS.NRTDMS.Sessions.Count))
End If
ImanSession.Timeout = 1200
BBLogging.LogEvent(BBLogType.AppInfo, "New Session Added To DMS")
Try
ImanSession.Login(CurUserConfig.UserID, CurUserConfig.Password)
Catch ex As Exception
BBLogging.LogEvent(BBLogType.AppWarn, "Login Failed: " & BBSession.CurUserConfig.UserID)
End Try
Catch ex As Exception
BBLogging.LogEvent(BBLogType.AppError, "Perform Login Error For: " & BBSession.CurUserConfig.UserID, ex)
End Try
End Sub
Migrateduser
Alex,
Don't store the DMS in the Cache, instead store the DMS object in the Session ( they way you are doing for imansession) - You dont need to store IMANsession seperately in the session - Just get the DMS from the session and get iterate through the session collection to get the required session
alex_abell
Hi Sheetal,
Thank you for you advice. This is actually what I am doing already. I just thought that the way I was doing it was incorrect and I should only have one ManDMS object for the entire application that all users connect to. I will stick with current code that creates a new ManDMS object for each user and stores it in the session.
Thank you for all your help.
Alex