Copied to clipboard

Flag this post as spam?

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


  • Adrian 9 posts 109 karma points
    Jul 18, 2022 @ 10:24
    Adrian
    0

    Restricting media based on cookie

    Hi,

    I have a site wide disclaimer which prevents access to pages unless the disclaimer has been accepted (which sets a cookie for the check). This doesn't apply to media however, is there a ways to make media only servable after the disclaimer has been set / only serve media based on a set cookie?

    Thanks. -Adrian

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Jul 18, 2022 @ 10:49
    Huw Reddick
    0

    You will probably need to write some sort of middleware code (would have been an IHttpHandler in old .Net) which checks for the cookie before allowing access.

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Jul 18, 2022 @ 14:30
    Huw Reddick
    100

    This post should get you started intercept-all-media-requests

  • Adrian 9 posts 109 karma points
    Jul 18, 2022 @ 14:47
    Adrian
    0

    Thanks, that looks very helpful.

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Jul 18, 2022 @ 15:16
    Huw Reddick
    0

    shout if you get stuck on anything

Please Sign in or register to post replies

Write your reply to:

Draft