Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access Cookie (and QueryString) collection ? #164

Open
imanabidi opened this issue Jul 10, 2020 · 0 comments
Open

How to access Cookie (and QueryString) collection ? #164

imanabidi opened this issue Jul 10, 2020 · 0 comments

Comments

@imanabidi
Copy link

imanabidi commented Jul 10, 2020

I need to access Cookies and Query Params inside of my handler.

I found that from the official documentation about triggercontexts that there is a way of accessing some parameters of HttpContext via IContextProvider injection which works like below code and it is very handy.

internal class CallbackHttpRequestHandler : CommandHandlerBase<CallbackHttpRequestDto, IActionResult>
  {
    private readonly IContextProvider _contextProvider;
    public CallbackHttpRequestDtoHandler(IContextProvider contextProvider) : base(false)
    {
        _contextProvider = context;
    }
    protected override async Task<IActionResult> ExecuteAsync(CallbackHttpRequestDto request,   IActionResult previousResult)
    {
        if (_contextProvider.HttpContext != null)
        {
            var headers = _context.HttpContext.Headers;
            var requestUrl = _context.HttpContext.RequestUrl;
            var claimsPrincipal = _context.HttpContext.ClaimsPrincipal;
         }
    }
  }

But there is no mapping between original HttpRequest Cookies collections and I need it.

How can I achieve that? I found it not easy inside the SDK to pass this Cookies collection. Please help.

Also posted here on SO

@imanabidi imanabidi changed the title How to access Cookie collection (and QueryString) collection ? How to access Cookie (and QueryString) collection ? Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant