I’m trying the AspNetPanel to host a webform. According to the Docs, “The code in the hosted ASP.NET/MVC page can access any component in the current Wisej application session simply by using the Wisej.Web.Application class.” However, although I set a Wisej.Web.Application.Session.MyVariable in the form containing the AspNetPanel, when I try to access it from within the hosted webform, I find out that Wisej.Web.Application.Session is null.
Is there some misunderstanding?
Luca I had been using the Wisej.Web.dll you had sent me to fix the CheckedList (it has a version 220.127.116.11). I thought it might have been this and changed back to the official 1.3.14, and also put your Session restore in OnLoad. And then I saw Frank’s example working. But it proved to be pure luck… on a second attempt I got the null reference exception again.
On top of that, now I ran the example a few times in a row, I saw that some times the browser opens with the window showing the textbox (in the window) and the button in the Aspnet panel and sometimes with the aspnetpanel filling the whole browser (as if it is docked to fill) and, thus, hiding the textbox (no window borders show up those times). And then the null reference always shows up.
I’m very puzzled. Shall I keep using the 18.104.22.168 version ? Can it be related in any sense to this behaviour?
We tried in many ways but always get a valid session. The Wisej session is restored in Wisej.Core.HttpModule (configured in Web.config) when processing HttpApplication.BeginRequest for pages ending in aspx or cshtml. But in some cases the thread firing BeginRequest is different from the thread executing the Asp.Net page.
You can also restore the Wisej session using Application.RestoreSession(context). You can place that in Page.Loado or Page.Init, or anywhere before using the Wisej session.
Try this and let me know:
protected override void OnLoad(EventArgs e)
Thanks for your answer.
However, this is exactly what I’m doing. In fact, when I run the application you sent, I see the same Null reference exception I saw in my code. Wisej.Web.Application.OpenForms is null, exactly as Wisej.Web.Application.Session was null, in what I had tried.
here is a basic sample for that kind of integration that should also give you an understanding for your problem.
Is the ASP page perhaps in a different site of the same server ?
Hope that helps.