So in short, with all the new tech added to MVC there is no flexible and/or dynamic way to affect the behavior of @Html.BeginForm? We are left with the only option of reverting back to an explicitly declared Form tag? A bit disappointing seing how they added
the new RequiresHttpsAttribute but left it up to us to check, enforce and handle it ourselves. :'( Well it it must be that way.
Use <form url=`@Url.Action..... Url.Action allows to specify also the protocol. BeginForm has not too many options because typically it is used wiht the same protocol of the url of the page it is in.
rashadrivera...
Member
12 Points
8 Posts
How to change POST to SSL URL in MVC 4
Mar 17, 2012 04:26 PM|LINK
Hello All,
I wanted to know if there was an easy way to make the user' POST action redirect to the HTTPS version of a site. So for example a user goes to http://www.omegusprime.com/Request/ABC and fills out a form. How can I make the SUBMIT button post to https://www.omegusprime.com/Request/ABC?
I'm aware of the RequireHttpsAttribute, but that does not affect how the Html.BeginForm() behaves.
rashadrivera_AT_omegusprime.com
BrockAllen
All-Star
27522 Points
4901 Posts
MVP
Re: How to change POST to SSL URL in MVC 4
Mar 17, 2012 05:48 PM|LINK
<form action='https://foo.com/...>
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
newbiefreak
Member
468 Points
214 Posts
Re: How to change POST to SSL URL in MVC 4
Mar 17, 2012 06:07 PM|LINK
why dont you set form action attribute from code behind after client event or on pageload if there are no other click button events
or in html
rashadrivera...
Member
12 Points
8 Posts
Re: How to change POST to SSL URL in MVC 4
Mar 18, 2012 03:21 PM|LINK
rashadrivera_AT_omegusprime.com
francesco ab...
All-Star
20912 Points
3279 Posts
Re: How to change POST to SSL URL in MVC 4
Mar 18, 2012 08:27 PM|LINK
Mvc Controls Toolkit | Data Moving Plug-in Videos