1
votes

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
System.Web.Routing assemly doesn't seem to be available. Can you try add it using web.config file? Here's how: stackoverflow.com/questions/2828393/… - Mosia Thabo
You said you use asp.net core,but why did you use System.Web.Mvc?It is the dll in asp.net. - Rena
Thank you Mosia that's working after i install Microsoft.AspNetCoreCore.Routing. - ismail haroun

1 Answers

0
votes

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