Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Getting session object
RajanP
Hi,
Is it possible to re-create the session object which we have already got from login method? for e.g.
In a dll i am having 2 functions Login and Logout
Code for login is
void login(String strUserName, String strPass)
{
IManDMS myDMS = new ManDMSClass();
IManSession mySess = myDMS.Sessions.Add("v07ps45372k3");
mySess.Login(strUserName, strPass);
}
void LogOut()
{
...........
mySess.Logout();
}
I want to get IManDMS or IManSession Object in my logout function. As it is a .NET dll ( Managed C++) I am not able to keep global or static objects. Is there any way to get back session id previously generated?
-Rajan
Find more posts tagged with
Comments
Migrateduser
Hi Rajan, I suppose you want to use this in an aspx page.
Once you have created the new session object you would have to set this as the current.
So, I what I would do is:
First create a currentSession
SessionContext sessionContext = SessionContext.Current;
if (sessionContext != null)
{
IManSession oSession;
oSession = SessionContext.Current.Session;
if ! (oSession.Connected)
{
... Create a new imanSession, call login
Second after login call oSession = mySess
I'm not sure, but I think I have done it as I told you and it worked...
Does it helps? hope so
Regards
Javi
Migrateduser
Hi Rajan, many sorrys....I didn't read your last line of the message....I understood you were trying to connect in a web application.
The only thing I see about your logout problems is the visibility of the object, is mySess visible inside logout function?
apologize again for my wrong information.
Regards
Javi
RajanP
Hi Javi,
I have resolved the problem. I am storing IManDMS objects in a global hashtable. I can get back the session from the IManDMS object.
public ref class GlobalClass1
{
private:
static Hashtable^ hstable = nullptr;
static IManDMS^ m_globalVar;
public:
static IManDMS^ getGlobalVar(String^ strID)
{
return (IManDMS^)hstable[strID] ;
}
static void setGlobalVar(String^ strID ,IManDMS^ glob)
{
if(hstable == nullptr)
{
hstable = gcnew Hashtable() ;
}
hstable->Add(strID,glob) ;
}
};
-Rajan
Migrateduser
Cool Rajan!
Good idea not to follow my advices....:-)
I have to read slowlier or...Improbe my english..lol
Regards
Javi
bumplabels.zip