Copied to clipboard

Flag this post as spam?

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


  • Ganesh Mitra 51 posts 211 karma points
    Dec 06, 2023 @ 07:34
    Ganesh Mitra
    0

    RawUrl in umbraco 11

    Hi,

    We are using umbraco 11 latest version. Is there any way to get RawUrl before rewrite in IIS? I have a rewrite rule in web.config which rewrite a url if match found. Now I want to get RawUrl e.g. My Raw url is https://example.com/drapes-equipment-covers/72586-00034-00/ rewrite to https://example.com/product/?x=drapes-equipment-covers&y=72586-00034-00 But RawTarget return https://example.com/product/?x=drapes-equipment-covers&y=72586-00034-00

    > public static class HttpRequestExtensions {
    >     public static Uri GetRawUrl(this HttpRequest request)
    >     {
    >         var httpContext = request.HttpContext;
    > 
    >         var requestFeature = httpContext.Features.Get<IHttpRequestFeature>();
    > 
    >         return new Uri(requestFeature.RawTarget);
    >     } }
    
  • Ganesh Mitra 51 posts 211 karma points
    Dec 07, 2023 @ 16:32
    Ganesh Mitra
    0

    Bump

  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    Dec 07, 2023 @ 18:12
    Huw Reddick
    0

    I think the problem here is that IIS rewrites occur before the app receives any requests, so the .netcore webapp never sees the original URL, I could be wrong but that's what it looks like. You would probably be better to write your own middleware do do the rewrites rather than using IIS it is not difficult

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies