mirror of
https://github.com/volodymyrsmirnov/MalwareMultiScan.git
synced 2025-08-23 21:12:22 +00:00
18 lines
569 B
C#
18 lines
569 B
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace MalwareMultiScan.Shared.Attributes
|
|
{
|
|
public class UrlValidationAttribute : ValidationAttribute
|
|
{
|
|
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
|
|
{
|
|
var uri = (Uri) value;
|
|
|
|
if (uri == null || uri.Scheme != "http" && uri.Scheme != "https")
|
|
return new ValidationResult("Only http(s) URLs are supported");
|
|
|
|
return ValidationResult.Success;
|
|
}
|
|
}
|
|
} |