Developer forum

Forum » CMS - Standard features » Losing backoffice session

Losing backoffice session

Mario Santos
Reply

Hi,

Due some custom login requests by the customer, I have the following code on my master template:

if (Dynamicweb.ExecutingContext.IsFrontEnd()){
    if (!Dynamicweb.Security.IsCurrentUserAllowed(Pageview.Page)){
      var newSecurity = new Dynamicweb.Security();
      newSecurity.ExtranetLogoff(false);
      // more stuff here
    }
}

I was expecting that it will only logoff user on frontend, althought when I try to upload a document or delete a page I am being logged out from backoffice. Is this the correct behaviour?

DW version: 8.8.1.15

Thanks, Mário


Replies

 
Nicolai Pedersen
Reply

Yes, that is correct behavior. Session is abbandoned.

You can instead loop all items in session starting with "DW_extranet" and remove those from the session collection.

 
Mario Santos
Reply

Hi Nicolai,

 

Thank you for the other approach, but I think I did not made myself understand on the issue.

 

I have a master template with that piece of code, but I get looged out when I am in the backend (not the frontend). Funny thing is that I am not touching that template.

When I remove that code from the master template, the problem no longer occours.

 

Check screencast: http://www.screencast.com/t/pQG520y2

 

Thanks, Mário Santos

 
Nicolai Pedersen
Reply

The backend can make pageview instances in the backend when editing. I.e. in paragraph lists etc.

 
Nicolai Pedersen
Reply

You can add a ExecutingContext.IsFrontend() to your code.

 
Mario Santos
Reply

Hi Nicolai,

I have ExecutingContext.IsFrontend() as you can see at first seconds of screencast or first comment on this post.

BR, Mário

 

You must be logged in to post in the forum