Copied to clipboard

Flag this post as spam?

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


  • Anthony Kallay 3 posts 74 karma points
    Nov 30, 2018 @ 09:26
    Anthony Kallay
    0

    Public Access restricted page returns 200

    Hi,

    I have a member restricted area, the page correctly shows the login form but the url doesn't change and the response is 200

    How can i get it so a restricted page is redirected to /login with a 401 response?

    Cheers Anthony

  • louisjrdev 107 posts 344 karma points c-trib
    Nov 30, 2018 @ 09:31
    louisjrdev
    0

    Try adding this to the top of your template:

    @{Response.StatusCode = 401;}
    
  • Anthony Kallay 3 posts 74 karma points
    Nov 30, 2018 @ 09:47
    Anthony Kallay
    0

    Thanks but that appears to create a forever redirect loop

    I made it work with a statement but not sure this is the best method?

    if (!Request.Url.PathAndQuery.ToLower().Contains("login")) { Response.StatusCode = 401; }

Please Sign in or register to post replies

Write your reply to:

Draft