Skip to content

HttpContext is valid in Interactive Server Rendering Blazor pageΒ #34301

@huazhb

Description

@huazhb

Description

On the website, it says "IHttpContextAccessor must be avoided with interactive rendering because there isn't a valid HttpContext available." which seems not true. I use the IHttpContextAccessor on the Blazor page using Interactive Server rendering and I can access the HttpContext from IHttpContextAccessor without any issue. When switch to Interactive Client it will be null. (Of course it is since it is running on client side). So, I don't know where this statement coming from, or it will be invalid under some circumstances? Can anyone double check if this statement is valid for all Interactive rendering mode or it is only valid for the Interactive client mode?

Thank you

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/http-context?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/http-context.md

Document ID

79cb05f8-9ac0-26a8-8434-15de071160c3

Article author

@guardrex

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions