Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

modifications for Server-Side Blazor #25

Closed
wants to merge 1 commit into from

Conversation

AdmiralSnyder
Copy link

added an option to set the IUrlHelper and a flag that implies the use of a HttpClientHandler instead of a WebAssymbly-specific WebAssemblyHttpMessageHandler which throws in SendAsync

see dotnet/aspnetcore#10329

@AdmiralSnyder
Copy link
Author

I think the modified json file update is not neccessary...

@csnewman
Copy link
Owner

What is the exact behaviour of this when running server side?

It is expected that all requests are forwarded to the browser at all times.

@csnewman
Copy link
Owner

This seems to overlap #12, I'd advise reading my open comments on that PR.

@AdmiralSnyder
Copy link
Author

Hi,
I did read your comments; #12 did multiple things and changed some conceptual methods, so I thought I'd create a very small PR that really doesn't change anything conceptually, and works now (isn't a WIP).

I am not sure what you mean with "exact behaviour when running server side". In the released version (against preview5), there were two errors that occurred, one because of the hard reference to the WebAssemblyUriHelper.Instance, the other because of the WebAssembly-specific HttpClientHandler. Both were fixed, so the errors do not occur anymore when running server side.

@csnewman
Copy link
Owner

I now remember the main issue with this approach.

Using HttpClientHandler is not the correct behaviour, as this causes the server to send some of the requests (while the browser will still handle websockets etc).

The proper solution is to replace WebAssemblyHttpMessageHandler with a custom handler that always forwards the requests to the browser.

The reason this is incorrect behaviour is that if you wanted the server to send the requests, you can check at runtime whether you are using server side blazor and use the standard WithUrl method instead of the WithUrlBlazor method.

@csnewman csnewman closed this May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants