Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Xander 7 posts 38 karma points
    Jun 05, 2013 @ 08:01
    Xander
    0

    using Html.BeginUmbracoForm with HTTPS

    I have some working surface controllers that i'm developing. the actions get called from macro partials so they could potentially be used anywhere (http or https pages).

    I need to submit a form using ssl then return the same umbraco page (as per the usual way that surface controller actions are procesed).

    from what i read Html.BeginUmbracoForm uses a hidden input to pass routing info when the page is posted back to itself.

    If i don't use Html.BeginUmbracoForm it will not work as the surfaceControllers return CurrentUmbracoPage OR RedirectToCurrentUmbracoPage and must be a child action.

    using [RequireHttps] on the action throws an exception saying that you can't redirect from a child action. So there goes that idea.

    So how do i post over https in this situation?
    (note: i'm new to umbraco)

    Cheers,
    Xander

  • Xander 7 posts 38 karma points
    Jun 11, 2013 @ 03:06
    Xander
    0

    Please forgive me for saying this, but it's been 6 days now and i haven't got a single reply yet.
    It's kinda discouraging since posts that came after mine have all received replies.
    I would like some feedback on how i can improve my request so that i might receive more replies.
    Is it: too complicated; would take up too much time; not clear enough; so obvious that i should figure it out for myself; unclear title; not enough info; or what?

    For now I'm just going to go through the Umbraco source code and copy how the hidden input is created and put that into a regular @Html.BeginForm() and post back to the current page with https.

    I don't really like this solution because it could break when future upgrades of umbraco are applied, but for now it will do.
    If you have any further suggestions i'd love to hear them.

    Cheers,
    X

  • Mounhim Tahtahi 41 posts 62 karma points
    Jun 24, 2013 @ 09:30
    Mounhim Tahtahi
    0

    AFAIK it is not possible to use SSL and non-SSL combined in Umbraco. For what I have read it was recommended to have the whole site under SSL.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 07, 2013 @ 22:15
    Matt Brailsford
    3

    Hey Xander,

    It might be a bit late for you now, but I found a way to do this the other day so thought I'd post a reply for you / anyone who wants to do something similar.

    Basically, when you call BeginUmbracoForm you can pass it an object for additional html attributes, one of which can be "action" which would override the default action for the form (which for surface controllers would always be the URL of the current page). What you could do then is provide an action attribute with the current URL, but with the https prefix.

    @using(Html.BeginUmbracoForm("YourAction", "YourSurface", null, new { action = "https://yourdomain.com/your-page" })){
      ...
    }
    

    Now when your form renders, it will use YOUR action instead of the default generated one when rendering the form, allowing you to post back to a secure page.

    I'm guessing this will be a bit late for you now, but thought I'd post it anyways.

    Thanks

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft