Open Closed

redirect_uri problem #7210


User avatar
0
yusufsarman created
  • ABP Framework version: v8.0.1
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): Tiered
  • Exception message and full stack trace: No Exception
  • Steps to reproduce the issue: Hi. Our problem is When the user comes to our Blazor page with querystring , we want him to be directed to the same link again after successful login. For example, when the user comes to us with the URL https://testproject.com\myuser?id=1234, we want the user to return to the \myuser?id=1234 page instead of the default page when returning to the Blazor application after authentication.We try to override redirect_uri but as i understand correctly OpenIdDict library overrides it Thank you
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

10 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share full logs of all related requests?

    Thanks

    liming.ma@volosoft.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    yusufsarman created

    Hi.Actually request did not shown on logs. But i share it anyway https://we.tl/t-wdky8sp5FI

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks I will check and find a way.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can use the URL like: https://localhost:44309/account/login?returnUrl=/MyPage The returnUrl parameter can do this.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    yusufsarman created

    Hi ; we redirect non-login user to login page with tihs code. how can we transport return url with this code

        app.Use(async (httpContext, next) =>
        {
            if (!httpContext.Request.Path.ToString().Contains("account/login"))
            {
                if (httpContext.User.Identity is not { IsAuthenticated: true })
                {
                    httpContext.Response.Redirect("/account/login");
                    return;
                }
            }
    
    
            await next();
        });
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer
    var yourPage = get page(querystring) from httpcontext
    httpContext.Response.Redirect("/account/login?returnUrl=" + yourPage);
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    yusufsarman created

    My page is dynamic. for example : https://subdonamin.domain.com/crm-aday-details?adayId=4503#0 My scenario ;

    1. User can go to link with parameter.
    2. if user doesn't login, we want to redirect to login page with user return url
    3. But we cant trasport dynamic return url to login page.

    we get reference from this ticket https://support.abp.io/QA/Questions/5206/Blazor-Server---Force-Authentication-For-Root--Entire-Site

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try that:

    app.Use(async (httpContext, next) =>
    {
        if (!httpContext.Request.Path.ToString().Contains("account/login"))
        {
            if (httpContext.User.Identity is not { IsAuthenticated: true })
            {
                ///crm-aday-details?adayId=4503#0
                var path = httpContext.Request.GetEncodedPathAndQuery();
                if (path.IsNullOrWhiteSpace() || path == "/")
                {
                    httpContext.Response.Redirect("/account/login");
                }
                else
                {
                    httpContext.Response.Redirect("/account/login?returnUrl=" + path);
                }
    
                return;
            }
        }
    
        await next();
    });
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    yusufsarman created

    thanks you. it works fine I implment similiar code but I will use your code .

    I implement this code. But your code is more than smart to my code //string returnUrl = httpContext.Request.Path.ToString() + httpContext.Request.QueryString.ToString(); //if(returnUrl != null && returnUrl != "/") //httpContext.Response.Redirect("/account/login?returnUrl=" + returnUrl); //else //httpContext.Response.Redirect("/account/login");

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Great

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.