Developer forum

Forum » Development » Module renders in backend?

Module renders in backend?

Lars Skov
Reply
Hello

I have created a DW Module to deny access based on ip-filtering. I have af field for allow ip addresses and a field for deny ip address.

The modules tests to see if current ip address apply to the ip addresses in the fields. If the rules indicate a deny i send the following back to the browser:

System.Web.HttpContext.Current.Response.StatusCode = 403;
System.Web.HttpContext.Current.Response.End();

It works perfectly in the frontend, but if I deny access for my own/current ip address I also get a 403 in the backend blocking all access to the page i just created/edited.

Does the frontend part of the module render in the backend as well? And how do I test for it?

Customer is running version 19.2.5.2

Best regards

Lars Vistrup Skov


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer
Yes - the pageview is executed when doing a list of paragraphs, and editing the properties of a page.

You can build in a check that HttpContext.Current.Request.Url starts with "default.aspx" - the your code will only execute on the frontend.

Votes for this answer: 0
 
Lars Skov
Reply
Hi

And when the frontend user uses the syntax http://site.com/default.aspx?id=217 the module don't fire the 403 :-S

Is there no other solution?

Best regards
Lars
 
Nicolai Høeg Pedersen
Reply
You can easily check if the pageview is executed in frontend or backend. If the HttpContext.Current.Request.Url starts with "default.aspx" it is the frontend, otherwise the backend...
 
Lars Skov
Reply

Sorry, read it wrong....
 
Nicolai Høeg Pedersen
Reply
No problem. I do that all the time :-).

 

You must be logged in to post in the forum