# Dotnet: RedirectUri is ignored?

**URL:** <https://community.auth0.com/t/dotnet-redirecturi-is-ignored/137909>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [July 2, 2024, 8:26am UTC](https://community.auth0.com/t/dotnet-redirecturi-is-ignored/137909 "2024-07-02T08:26:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![markus.dresch](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@markus.dresch](https://community.auth0.com/u/markus.dresch)\
**Post date:** [July 2, 2024, 8:26am UTC](https://community.auth0.com/t/dotnet-redirecturi-is-ignored/137909/1 "2024-07-02T08:26:55Z")

</div>

I have a dotnet reverse proxy (YARP+Auth0) and an Angular Frontend, using Angulars proxy to make calls to the deployed Apis. But when developing locally, on for example default [http://localhost:4200](http://localhost:4200), after logging in, Auth0 redirects not to localhost but to [https://dev.mydomain.com](https://dev.mydomain.com).

The redirect uri is passed with the authenticationProperties, but seems to be ignored. Any pointers?

```auto
async Task Login(HttpContext context)
{
    if ($"{context.Request.Headers.Referer}".StartsWith("http://localhost:4200/"))
    {
        redirectUri = "http://localhost:4200/";
    }

    var authenticationProperties = new LoginAuthenticationPropertiesBuilder()
        .WithRedirectUri(redirectUri!)
        .WithParameter("connection", "xxx")
        .Build();

    if (authenticationProperties.RedirectUri == "/" && context.Request.Query.ContainsKey("ReturnUrl"))
    {
        authenticationProperties.RedirectUri = context.Request.Query["ReturnUrl"];
    }

    await context.ChallengeAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);
}

```

---

<div class="post-metadata">

**Author:** ![markus.dresch](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@markus.dresch](https://community.auth0.com/u/markus.dresch)\
**Post date:** [July 2, 2024, 9:02am UTC](https://community.auth0.com/t/dotnet-redirecturi-is-ignored/137909/2 "2024-07-02T09:02:28Z")

</div>

seems like this does the job:

```auto
        // .WithRedirectUri(redirectUri!)
         .WithParameter("redirect_uri", redirectUri!)

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 12, 2025, 7:46pm UTC](https://community.auth0.com/t/dotnet-redirecturi-is-ignored/137909/3 "2025-05-12T19:46:09Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
