mercredi 16 août 2017

Rendering HTML using Embedded Code Blocks

I am looking at some older HTML in an .ascx file which has an embedded code block "<% Some Server Logic %>". I get that best practice is to control server logic on the server, for maintainability and debugging and.... I see that it is bad. Not my code I am just trying to understand why someone would put this in the code. Is it just old code that at the time was cutting edge and why it's implemented or is it just junk?

The code is testing a user's role and based on the role they then execute/render the HTML within the conditional statement. Does this prevent the HTML from rendering at all, or should it?

Here is a sample:

<% if (userRole.IsInRole("someRole") || userRole.IsInRole("AnotherRole")) { %> 
<section id="someId">
   <div>Some Html</div>
</section> 
<% } %>




Aucun commentaire:

Enregistrer un commentaire