ismail haroun
ismail haroun

Reputation: 31

Error When add Remote attribute to asp.net core

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.")]



Upvotes: 2

Views: 458

Answers (1)

ismail haroun
ismail haroun

Reputation: 31

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

Upvotes: 1

Related Questions