How do I get the current Url from within a FilterAttribute?

后端 未结 4 2069
星月不相逢
星月不相逢 2021-02-03 18:17

I am writing an Authorize filter attribute adn I\'m having trouble figuring out how to get the current url as a string so I can pass it as a parameter to the LogOn action. The g

4条回答
  •  终归单人心
    2021-02-03 18:35

    In my specific case I was after the UrlReferrer URL.

    filterContext.HttpContext.Request.UrlReferrer
    

    This one let me redirect the user back to the page he was before trying to access an action he doesn't have permission to access.

提交回复
热议问题