Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

FromRouteAttribute doesn't seem to work in Razor Pages #6402

Closed

Description

@sebastienros
[FromRoute]
public string Foo {get;set;}

With this route:

@page "{Foo}"

Foo is empty, however I can access the value with RouteData.Values["Foo"]

Activity

  1. changed the title [-]FromRouteAttribute doesn't seem to work in RP[/-] [+]FromRouteAttribute doesn't seem to work in RazorPages RP[/+] on Jun 16, 2017
  2. changed the title [-]FromRouteAttribute doesn't seem to work in RazorPages RP[/-] [+]FromRouteAttribute doesn't seem to work in Razor Pages[/+] on Jun 16, 2017
  3. pranavkm commented on Jun 19, 2017

    @pranavkm
    Contributor

    Is this on a GET request? We don't execute any model binders by default for GET requests. You have to explicitly annotate the property to state this:

    [BindProperty(SupportsGet =  true)]
    [FromRoute]
    public string Foo { get; set; }
  4. added this to the 2.0.0 milestone on Jun 19, 2017
  5. sebastienros commented on Jun 19, 2017

    @sebastienros
    MemberAuthor

    Then you can close if it's by design.

    But do you mean it's model bound for some other verbs?

  6. rynowak commented on Jun 19, 2017

    @rynowak
    Contributor

    We're going to take some action here to make pages 100% consistent with controllers.

  7. added a commit that references this issue on Jun 26, 2017
  8. added a commit that references this issue on Jun 27, 2017
  9. rynowak commented on Jun 27, 2017

    @rynowak
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions