kenticokentico-13

How to get current page URL in .cshtml from Kentico 13 core?


How could we get the current page URL in .cshtml page for Kentico 13.

Used @Context.Request.GetDisplayUrl().ToString() but getting the below error 'HttpRequest' does not contain a definition for 'GetDisplayUrl' and no accessible extension method 'GetDisplayUrl' accepting a first argument of type 'HttpRequest' could be found (are you missing a using directive or an assembly reference?)


Solution

  • Use this namespace "@using Microsoft.AspNetCore.Http.Extensions" see the image for better experiance