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...

2
  • 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 Commented Nov 16, 2013 at 13:59
  • @davethecoder How to check that? and how to do that? could you explain me more detailed please? Commented Nov 18, 2013 at 9:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.