1

I have a mvc4 view form with some fields, let's say:

  • User name
  • Surname
  • Age
  • Code

below an example:

@{
      var actionURL = "https://"  + Request.Url.Host + Request.Url.PathAndQuery;

  using (Html.BeginForm("AddUser", "Configure", FormMethod.Post), new { @action = actionURL })
  {
    ...
    @Html.TextBoxFor(model => model.UserViewModel.Name, null, new { id = "UserName" })
    @Html.PasswordFor(model => model.UserViewModel.UserCode, new { id = "UserCode" })

    ...

    <input id="submitUser" type="submit" value="Send" />

    ...
  }

}

ConfigureController.cs:

    [RequireHttps]
    public ActionResult AddUser(UserViewModel model)
    {
        // Encrypt user code and store it in database
        // Store in database the rest of user information as-is, without encrypting
    }

Code field should be encrypted once user info is submited through internet but other fields are not necessary. Then once I recieve user info in the controller, I encrypt the code field and store it in the database. Other user information is stored in database as-is.

I want to encrypt the user code in server side not in client side.

My problem is that once submit button is clicked an error is thrown, a page is shown saying:

  • Ensure web address https://... is correct
  • Search the page with you search engine
  • Update/Refresh the page in a few minutes
  • Ensure TLS/SSL protocols are enabled by going to Tools->Internet Options->Advanced options->Configuration->Security

I have ensured that TLS and SSL protocols are enabled: SSL 3.0 and TLS 1.0 are enabled.

What's wrong? and how to send code encrypted to the mvc4 controller? I do not want to make changes in web.config.

I have tried other solutions like explained below, but nothing works for me:

building own action filter: ASP.NET MVC RequireHttps

using form action instead of html.beginform: How to change POST to SSL URL in MVC 4

but nothing works...

Community
  • 1
  • 1
user304602
  • 991
  • 4
  • 21
  • 39
  • make sure that both your View ( GET ) and your Processor ( POST ) have the RequireHttps. Looks like your POST requires it, but your GET does not – davethecoder Nov 16 '13 at 13:59
  • @davethecoder How to check that? and how to do that? could you explain me more detailed please? – user304602 Nov 18 '13 at 09:53

0 Answers0