problem
why result not changed on browser invoke method custom middle ware after loaded for first time ?
1 - I put breakpoints on invoke method on custom middle ware and run visual studio on run time first time .
2 - after load it hit function invoke then it check variable AccessTokenValue it will be null so that it print on browser invalid value .
until here not have any problem .
3 - after that i open post man program and run it .
and put URL as get request then add on header
key :Authorization
Value:1234
4 - after that press send button from post man it hit breakpoints of invoke method and check variable AccessTokenValue and check his value it become 1234 so that it return on post man
valid value but on my browser value still invalid value .
Are this normal and why browser not refresh to update status based on condition statement on invoke method why his value still after load fixed or this futures of middle ware
Can any one help me ?
I work on visual studio 2017 asp.net core 2.2 i do following steps as following
What I have tried:
public async Task InvokeAsync(HttpContext context)
{
var AccessTokenValue = context.Request.Headers["Authorization"].SingleOrDefault();
if (AccessTokenValue == "1234")
{
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
await context.Response.WriteAsync("valid value");
}
else
{
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
await context.Response.WriteAsync("Invalid value");
}
}
}