title: How to prevent specific extension in asp.net FileUpload Control?
body: <p>I want to provent few extensions to load in FilUpload control. I have review few references</p>
  
  <p><a href="https://forums.asp.net/t/1051895.aspx?Fileupload+allow+only+jpg+gif+and+png" rel="nofollow noreferrer">https://forums.asp.net/t/1051895.aspx?Fileupload+allow+only+jpg+gif+and+png</a></p>
  
  <p><a href="https://stackoverflow.com/questions/8491257/asp-net-limit-file-upload-available-file-types">ASP.NET - Limit file upload available file types</a></p>
  
  <p>But all are related to "which extensions should be allowed". But I need "which extensions should not allowed".</p>
  
  <p>Can anybody please suggest me regular expression or any other way? I don't want to check manually while submiting.</p>
  
  <p>I have read this example which regular expression about which files to allow. But I need ValidationExpression which doesn't allow some extension. I have list of extension which should not allowed. Can anybody suggest me <code>ValidationExpression</code> of it?</p>
  
  <pre><code>&lt;asp:RegularExpressionValidator ID="uplValidator" runat="server" ControlToValidate="FileUpload1"
  ErrorMessage=".mp3, .mp4 &amp; wma formats are allowed" 
  ValidationExpression="(.+\.([Mm][Pp][3])|.+\.([Mm][Pp][4])|.+\.([Ww][Mm][Aa]))"&gt;&lt;/asp:RegularExpressionValidator&gt;
  </code></pre>