Aspnetcore: How can I access the ConnectionContext from Blazor server-side

Created on 19 Sep 2019  路  6Comments  路  Source: dotnet/aspnetcore

Is there a way to do that ?

Thanks....

area-blazor

Most helpful comment

@mkArtakMSFT any updates on this? Really need this functionality in my app and would prefer to use native functionality than the weird workarounds with the Javascript interop. 馃槅

All 6 comments

@enetstudio Thanks for contacting us.

We don't pass in the connection context to Blazor Server-side applications.

What are you trying to accomplish? Why do you want to have access to the connection context?

I thank you for the time you took to respond. I'd like to get client information such as IP adress and browser name/version in Blazor server-side.

I read this comment anurse:
For the IP address, you can use the GetHttpContext extension method on ConnectionContext to get an HttpContext and then use the Connection property on there to find the client information.

And this:

944 added better support for getting Client IP data, and the rest is all available off the HttpContext via the ConnectionContext.GetHttpContext method.

Link: https://github.com/aspnet/SignalR/issues/1114

But not a word about how to access ConnectionContext.

Once again, I want to get client information such as IP address and browser name/version in Blazor server-side...

Many thanks...

Thanks for contacting us, @enetstudio.
There is no a good way to do this at the moment. We will look into how we can provide make this information available to the client.

@mkArtakMSFT any updates on this? Really need this functionality in my app and would prefer to use native functionality than the weird workarounds with the Javascript interop. 馃槅

@Andrew-Pynch We recommend you follow the approach described here to pass any data you need from the request into the Blazor app

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aurokk picture aurokk  路  3Comments

BrennanConroy picture BrennanConroy  路  3Comments

UweKeim picture UweKeim  路  3Comments

githubgitgit picture githubgitgit  路  3Comments

guardrex picture guardrex  路  3Comments