WebForm hosted in AspNetPanel accessing wisej Session

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
0
0

Hi,

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?

Best,
Alex

  • You must to post comments
0
0

Hi guys,

Luca I had been using the Wisej.Web.dll you had sent me to fix the CheckedList (it has a version 1.3.14.1). 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 1.3.14.1 version ? Can it be related in any sense to this behaviour?

Alex

  • Luca (ITG)
    Nothing changed in 1.3.14.1 for the session restore feature. When you run from VS if you have the aspx page open, VS will simply open the page, check the URL in the browser. If the URL in the browser is the aspx page then the Wisej session is null since you are running he aspx page by itself. Are you running the test using the IIS Development server with VS?
  • Alex Prinias
    Whoops! You found it Luca! I was seeing the aspx page itself and NOT the window! Sorry for that. When I close it in VS (both the aspx and aspx.cs files) I get the correct result, even with 1.3.14.1 and without the session restore. Sorry for the false alert!!! Best, Alex
  • You must to post comments
0
0

Hi Alex,

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)
{
Wisej.Web.Application.RestoreSession(this.Context);
}

Best,
Luca

  • You must to post comments
0
0

Dear Frank,

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.

Best,
Alex

  • You must to post comments
0
0

Hi Alex,

here is a basic sample for that kind of integration that should also give you an understanding for your problem.

http://wisej.s3.amazonaws.com/support/attachments/Wisej.AspNetFormIntegration.zip

Is the ASP page perhaps in a different site of the same server ?

Hope that helps.

Best regards
Frank

 

  • You must to post comments
Showing 4 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 5, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json