Parameters posting back correctly, locally (macOS) but not on Umbraco Cloud (Windows, same code)
Hello,
I created a component which works correctly on my machine (MacOS), but when I deploy code to Umbraco Cloud, parameters are all empty
This next part works correctly, parameters are there (verified by using some simple hidden inputs which have values)
@await Component.InvokeAsync(Inventory.ModelTypeAlias, new
{
type = type,
year = year,
make = make,
model = model,
priceRange = priceRange,
sortBy = sortBy,
page = page
});
This next part however, loses parameters (they are all empty) - only on Umbraco Cloud. On my MacOS machine, for some reason, parameters get there correctly
Is it possible the url is malformed / parameter values are not properly encoded? Some servers may block urls that have potentially damaging url parameters (think of the old sql injection).
That might explain why it works locally.
Try analysing your url to see if there's any characters in there or unencoded entities (spaces, special chars).
Just figured it out. I did a lot of logging to figure out where parameters are lost, and I narrowed it down as a matter of view rendering (parameters were getting correctly to view component, view model was set correctly)
I removed caching from the way I was invoking my partials and it worked!
Parameters posting back correctly, locally (macOS) but not on Umbraco Cloud (Windows, same code)
Hello,
I created a component which works correctly on my machine (MacOS), but when I deploy code to Umbraco Cloud, parameters are all empty
This next part works correctly, parameters are there (verified by using some simple hidden inputs which have values)
This next part however, loses parameters (they are all empty) - only on Umbraco Cloud. On my MacOS machine, for some reason, parameters get there correctly
View Component:
I can't find any logical reason why parameters would get to the view component on my machine, but not on Umbraco Cloud.
Need help please.
FYI, when I send parameters to the view component, they are sent like this
Posting the Umbraco Cloud url too, if this helps narrowing down the issue: https://speed-digital-sandbox.useast01.umbraco.io/inventory/
Is there a reason you dont create a viewmodel for your data? not sure this helps you in this case - but I personally would always do that.
Is it possible the url is malformed / parameter values are not properly encoded? Some servers may block urls that have potentially damaging url parameters (think of the old sql injection).
That might explain why it works locally.
Try analysing your url to see if there's any characters in there or unencoded entities (spaces, special chars).
Just figured it out. I did a lot of logging to figure out where parameters are lost, and I narrowed it down as a matter of view rendering (parameters were getting correctly to view component, view model was set correctly)
I removed caching from the way I was invoking my partials and it worked!
Change from:
Changed to
Ah - I should have thought of this.
Caching is only enabled on live. The times I've tested things locally - forgetting it's a debug build and then scratched my head on live.
is working on a reply...