1

I'm trying to send a form request to an action, also one of my inputs is from text editor which contains HTML tags. The problem is I get the error below:

A potentially dangerous Request.Form value was detected from the client

Also I've put [AllowHtml] in the model:

[UIHint("Html")]
    [AllowHtml]
    [Display(Name = "Description")]
    public string Description { get; set; }

and this code in the action:

[HttpPost]
    [ValidateInput(false)]
    [ValidateAntiForgeryToken]
    public virtual async Task<ActionResult> Create(ProductViewModel viewModel)
    {
        if (!ModelState.IsValid)
        {
            var groups = await _groupService.GetAllAsync();
            viewModel.GroupList =
                groups.Select(p => new SelectListItem {Text = p.Title, Value = p.Id.ToString()}).ToList();
            return View(viewModel);
        }

        _productService.Insert(viewModel);
        return RedirectToAction("Index");
    }

so what's the problem?

Araz Pashazadeh
  • 111
  • 1
  • 5

0 Answers0