我有一個OwinMiddleware
與Invoke
方法尋找一種像這樣:找不到IOwinContext對象內部的獲取方法的結果
public override async Task Invoke(IOwinContext context)
{
...
//The next line launches the execution of the Get method of a controller
await Next.Invoke(context);
//Now context.Response should contain "myvalue" right?
...
}
的Invoke
方法調用Get
方法,位於控制器內部,看起來有點像這樣:
[HttpGet]
public IHttpActionResult Get(some params...)
{
...
return "myvalue";
...
}
的Get
方法執行後,該程序可以追溯到我的中間件Invoke
方法。我認爲Get
方法的響應,即myvalue
應該包含在context.Response
之內,但我不知道在哪裏,因爲它充滿了所有的東西。
這將是身體流。這似乎是[XY問題](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem)。你試圖達到的最終目標是什麼? – Nkosi
我想從Invoke方法中訪問「myvalue」以將其插入到一個arraylist中 – nix86