Reputation: 31
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
Reputation: 31
Solved - After i install Microsoft.AspNetCoreCore.Routing. The problem is using System.Web.Mvc in asp core project
Upvotes: 1