Error When add Remote attribute to asp.net core

Viewed 191

When i add [Remote()] attribute to a class property, the following exception gets throw:

TypeLoadException: Could not load type 'System.Web.Routing.RouteValueDictionary' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Entities
{
    [Serializable]
    public class EmployeeEntity
    {
        public int Id { get; set; }
        
        [Required(ErrorMessage = "Required")]
        [MaxLength(20)]
        [RegularExpression(@"^\S*$", ErrorMessage = "No white space allowed")]
        [Remote("IsUserNameAvailable", "Employee",HttpMethod ="GET", ErrorMessage = "EmailId already exists in database.")]



1 Answers

Solved - After i install Microsoft.AspNetCoreCore.Routing. The problem is using System.Web.Mvc in asp core project

Related