Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nguyen Dung Tri 106 posts 606 karma points
    Aug 08, 2016 @ 18:43
    Nguyen Dung Tri
    1

    Is there a way to detect being in Back-End or Front-End of Umbraco Site?

    Hello,

    Is there is a code in C# or Javascript that can detect where user is view on Back-End or Front-End of Umbraco Site?

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Aug 08, 2016 @ 20:00
    Alex Skrypnyk
    101

    Hi Nguyen,

    As I understand right, it's easy to do with UmbracoContext.IsFrontEndUmbracoRequest flag;

    UmbracoContext.IsFrontEndUmbracoRequest
    

    Thanks,

    Alex

  • Nguyen Dung Tri 106 posts 606 karma points
    Aug 12, 2016 @ 04:07
    Nguyen Dung Tri
    1

    Hi Alex,

    To access none-static member. We should use this:

    UmbracoContext.Current.IsFrontEndUmbracoRequest
    
  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Aug 12, 2016 @ 09:01
    Alex Skrypnyk
    0

    Thanks Nguyen, nice tip!

  • Ayo Adesina 445 posts 1059 karma points
    Dec 02, 2020 @ 15:38
    Ayo Adesina
    0

    I have a problem with the value being returned by UmbracoContext.Current.IsFrontEndUmbracoRequest

    If UmbracoContext.Current.IsFrontEndUmbracoRequest is giving me false... when it should give me true (its a page that is in the front end of the website) has anyone got any idea why I that value is false?

  • Jeroen Oostwouder 100 posts 296 karma points
    Aug 30, 2021 @ 14:43
    Jeroen Oostwouder
    0

    Just kicking this up, after almost a year... We've just encountered problems with this function.

    It also returns "false" if you call a surfacecontroller from the frontend. I don't know if that was what you're doing. But it caused us some headaches.

Please Sign in or register to post replies

Write your reply to:

Draft