I have a partial view which is displayed on a non-HTTPS page, but POSTS to a controller that requires SSL. The form definition is this:
<form id="authForm"
method="post"
action="@Url.Action("authenticate", "auth", new {}, "https")">
The problem I'm having is that, within Visual Studio and when debugging, the host and port are localhost:64043
. However, the Url.Action
call above doesn't put the port number in, meaning the browser directs to my IIS installation. Do I have to add something else, or override this method? I want my application to be location agnostic.
Thanks in advance!
You could include it like this:
@Url.Action(
"authenticate",
"auth",
null,
"https",
Request.Url.Host + ":" + Request.Url.Port
)
Of course this means that your local web server must support SSL which is not the case with Cassini. You could use IIS Express for this to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With