I'm developing a website that need to upload excel/csv files.
There is a way to validation files from hackers e.g. ensure that the files not contains malicious code?
Until now I have this:
public class ValidateFileAttribute : RequiredAttribute
{
    private readonly decimal filesize = 10;//10 MB
    bool result = false;
    string[] supporteFilesdTypes = new[] { "csv", "xls", "xlsx" };
    public override bool IsValid(object value)
    {
        var file = value as HttpPostedFileBase;
        if (file == null)
        {
            return false;
        }
        var fileExt = Path.GetExtension(file.FileName).Substring(1).ToLower();
        switch (fileExt)
        {
            case "csv":
            case "xls":
            case "xlsx":
                result = file.ContentLength > (filesize * 1024);
                break;
            default:
                break;
        }
        return result;
    }
}
public class ManipulateFile
{
    [ValidateFileAttribute]
    public HttpPostedFileBase FileUpload { get; set; }
    public ManipulateFile()
    {
    }
}
