Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to handle url redirect in dotnet core

$
0
0

I have a web application that wants to do authentication on every http request. I am trying to build a custom middle ware to do this

here is what I am looking to do

1. a user makes a request to an end point in my application http://localhost:5000/api/get-------> 302 Response

  1. I generate a redirect to do authorization http://{domain}/authorize ----------> 200 response if successful

  2. I return 200 with results if authorization is success or 401 if not http://localhost:5000/api/get-------> 200 or 401 response

in my middles ware I am calling httpContext.Response.Redirect("http://{domain}/authorize", false);

which generates the redirect, but how can I go from there? 

How can I capture the new httpContext which in that case the authorize call and how can I go back to the original context to return 200 after success?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>