Session from CustomAction
Session from CustomAction
I need access to Session variables when handling CustomActions events on the server. When I debug the Session property of HTTPContext.Current is null.
I have important business objects stored in session. They work together with imaging functionality controlling auditing, permissions, etc.
Can you help?
I have important business objects stored in session. They work together with imaging functionality controlling auditing, permissions, etc.
Can you help?
Re: Session from CustomAction
I think I figured out a solution. Add this to your Global.asax.cs and scope it to the level of docuviewerapi method that you want. Here I am attaching Session (read-only) to all of the api calls. ReadOnly ensures that multiple concurrent api calls won't block each other while waiting for a previous call to unlock writeable session.
Viola...session is available in the CustomActions and other methods triggered on server from DocuVieware!
Sean
Code: Select all
protected void Application_BeginRequest(object sender, EventArgs e)
{
//if docuviewerapi api method then lets attach session (readonly to minimize blocking)
if (HttpContext.Current.Request.Path.Contains("dvapi2/docuviewareapi"))
{
HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.ReadOnly);
}
}
Sean
Re: Session from CustomAction
Unfortunately it doesn't work for me. After adding this to the global.asax the custom action stops firering. Are there any other solutions?
Re: Session from CustomAction
I just tested with the latest release available (2.0.61) and I am unable to replicate the issue, it works as expected.
The custom action is firing properly and I am able to access the Session data I set in the Page_Load without issue.
The custom action is firing properly and I am able to access the Session data I set in the Page_Load without issue.
Who is online
Users browsing this forum: No registered users and 1 guest