Session vairables between .ASPX page and WiseJ forms

Answered
0
0

I read this post but it did not really help:

https://wisej.com/support/question/httpcontext-current-session-is-null

So – how can we share session variables with a .ASPX page ?

Actually I am using a .ASHX page as a handler to return pdf files to PDF.js – but I need to check a session variable to make sure the user id logged in or i risk exposing secure documents to the web.

 

When I try to use ImagingDB.PortalUser io_User = Application.HttpContext.Current.Session.LoggedInUser; it flags it as an error in Visual Studio.

So, how if any – is it possible to get to the WiseJ session in my own handler ?

  • You must to post comments
Best Answer
0
0

Hi Edmond,

HttpContext.Current and the session are different things. The HttpContext is just the current context for the current request thread. The session is bound to the browser’s instance either through a cookie storing the id or a session item. Wisej used to use cookies but now uses a session item (in private browsing it still uses a cookie since session storage is disabled in the browser).

At the end it comes down to an id.

These are the options:

  1. Add the session id to the ashx link: $”myhandler.ashx?sid={Application.SessionId}”. In ProcessRequest(context) use Wisej.Web.Application.RestoreSession(context).
  2. Store the authenticated state is a cookie and read it back in ProcessRequest(context).

HTH

  • edmond girardi
    I tried what you suggested and it works
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.