Results 1 to 1 of 1

Thread: How to use middle war to get next request asp.net core 2 ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2018
    Posts
    67

    How to use middle war to get next request asp.net core 2 ?

    How to get next request pipeline in case of token success .

    suppose i need to get data from action result get request by post man

    Code:
    [HttpGet(Contracts.ApiRoutes.Security.GetUserMenus)]  
           public IActionResult GetUserMenu(string userId)  
           {  
               string strUserMenus = _SecurityService.GetUserMenus(userId);  
               return Ok(strUserMenus);  
           }
    i write on postman link as then select get then write on header

    key : authorization
    value :eeerrttyyyyy

    when invalid access token then it will show message invalid token

    if valid access token it will continue execution and get result from action

    this is actually i need on next but cannot do it .

    Code:
    public async Task InvokeAsync(HttpContext context, DataContext dataContext)  
            {  
                  
                    var validKey = false;  
      
                   
                    if (!validKey)  
                    {  
                        context.Response.StatusCode = (int)HttpStatusCode.Forbidden;  
                        await context.Response.WriteAsync("Invalid Token");  
                    }  
                    //if validm than next middleware Invoke  
                    else  
                {  
                    //success token
                    context.Request.EnableRewind();  
                    await _next.Invoke(context);  
    // how to get next request meaning i need to get result of action getusermenu  
                    
                    }  
                  
                  
            }  
        }
    http://www.mediafire.com/view/h5am34...token.png/file
    Last edited by engbarbary; Sep 15th, 2019 at 03:11 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width