Node and routing problem MVC


Hey guys, so I'm trying to make a post in my project like so:

                @using (Html.BeginForm("Index", null, new { node = Model.ProfilePageReference }, FormMethod.Post))
                    @Html.Hidden("Email", user.Email)

However, without routing it doesn't find the correct controller/action, so I added this route:

  new { controller = "ProfilePage", action = "Index" });

Now it enters the correct Action in the correct Controller with the correct Email parameter, which gets the correct values etc.
However, now my currentPage is null, even though I specified a node for the correct page.
If I specify a controller it enters correctly, but the same problem is still there: the currentPage gets null.

If it helps, this is how the hierarchy in the tree looks like:

- Root
      - StartPage
             - ProfilePage    <--- target landing.>
             - GroupPage    <--- posted here.>

The URL's are as follows through the post:
1:   - Startpage
2:   - Next step, list of groups.
3:   - Specific group and all it's members.
4:    <--- here it tries to get a specific user in that group, and this is where something goes wrong. it enters the profilepagecontroller correctly but returns that url in the browser.>

How can I solve this?

Ludvig Flemmich

Dec 02, 2014 13:15

Try adding the current language as a route value (i think its ex: language="en"), and remove your custom route. I also always use currentContent instead of node, but I guess both work.

Dec 02, 2014 15:02

Hi! Should the GroupPage really be handled by the ProfilePageController (meaning, is it an instance of a ProfilePage type)? Do you have the correct node value (ContentReference) of the GroupPage you're posting to? Noticed that you, in your example code, are using Model.ProfilePageReference. Are you sure this is the correct ContentReference of the GroupPage you are posting to?

You shouldn't have to add any custom routing at all to be able to post to a EPiServer page controller action.

Btw, is it just in the example or are you posting to the Index action?

Dec 02, 2014 15:04

I'm posting from the GroupPage and want to recieve the parameter and node in the ProfilePageController, because that's where the user will be displayed.
So I want to pass an Email parameter from the GroupPage -> ProfilePage and recieve currentPage from the node.

Yes it's correct, it's the global settings you tipped me about the other day so I have a few standard pages and their contentReferences all set up.

Dec 02, 2014 16:16


Dec 09, 2014 14:19
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.