-
Notifications
You must be signed in to change notification settings - Fork 2.1k
FormTagHelper is missing asp-fragment. #4917
Comments
also POSTing to an url with fragments returns 400 bad request :( |
That seems expected since fragments are a client-side concept. How should an HTTP server handle a received |
This is mostly a routing issue than a posting issue. servers discard the fragment part on posts. That's ok, what I want to do is keep the routing/navigation url path. just to sample this better: create this html on any mvc route (ex:
Go to url: mvc returns a The expected behavior will be to submit to I'm trying to be clear, but let me know if this does not make sense, I think I spelled it quite confusing. |
It's not the server that discards the |
@Eilon you are right. What I don't understand then is why a post in a fragment url returns a Bad Request from MVC but not without the fragment and how the url (including the fragment) is preserved. |
Ok. I now see why MVC returned Bad Request. Is because when not using the About the asp-fragment on form tag helper:
This works flawlessly and the url in the browser ends in I'm not sure how exactly this works. The request on chrome inspector clearly shows that the fragment part is not present on the POST request, looks like it still use it to adjust the browser destination url to that address (including fragment). While it still would help to have the asp-fragment on the form taghelper, I guess this is more browser magic than anything else and maybe from a framework perspective is better to leave it as is. I let you decide what's best and feel free to close this issue. Probably is custom enough for me to handle in my code. Thanks for your time. |
@Bartmax ok, so to make sure I've understood, you'd still like to see an |
@Eilon I'm not sure, that's why I think it's better for you to decide maybe based on more customers. I do want to be able to manage the routing consistently alongside my app (aka creating url address for endpoints). |
I'd also like to see this feature. I have a single page app with a couple forms far past the fold and when they post back, I want the page to scroll down and show the validation messages. Thankfully @Bartmax's work around of adding |
I would like to use a fragment on the form action.
related #3988
The text was updated successfully, but these errors were encountered: