Posted on: 5/22/2015 3:58:35 AM | Views : 612

I'm trying to write an .NET application for uploading a file and restricting the file extension to .doc,.docx, .jpg.. I guess everything is okay with the Code.but still I can see "Unhandled expression error when I tried uploading a file with  different extension. 
The code is as follows:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace practice2 { public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) {
}
protected void Button1_Click(object sender, EventArgs e) { if(FileUpload1.HasFile) { string FileEx = System.IO.Path.GetExtension(FileUpload1.FileName);
if (FileEx.ToLower()!= ".doc" && FileEx.ToLower()!= ".docx" && FileEx.ToLower()!= ".jpg") { Label1.Text = &q ...

Go to the complete details ...