Failed to redirect a parameterized URL

Asked 2 years ago, Updated 2 years ago, 74 views

I am currently developing a web application using Django.

So I'm looking for a way to redirect a URL with parameters as the title suggests.

Specifically, I would like to redirect the URL with encrypted parameters as shown below.
If you try to redirect as it is now, you will be told that there is no route to match this URL.
Redirecting to a URL with no parameters will succeed.

Failed:
test_app/test/booking_test%3Fcsrfmiddlewaretoken%3DwE7PefQQwMjMJ3sn60uXO7HyoZT3t3y5cenAaWQoaNn52lVTxr1kAr89FfQQSMq%26id%3D193

Successful:
test_app/test/booking_test

The reason I want to do this is because I want to jump to the login screen with @login_required and continue with the previous operation after logging in.

I am very sorry that I am still understudied, but I would appreciate it if you could reply.

python django

2022-09-30 17:49

1 Answers

Isn't it because the query string "?" and "&" are encoded?
I think it will be as follows.

test_app/test/booking_test?csrfmiddlewaretoken=wE7PefQQwMjMJ3sn60uXO7HyoZT3t3y5cenAaWQoaNn52lVTxr1kAr89FfQQSMq&id=193


2022-09-30 17:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.