How Can Uploads Images To Folder and Sends Image Path to Database And how Change Image Name to my UserName Using ADO.NET : In this code Eror occurs when Save file to disk and I want Want Convert image name to my UserName What I can Do??? please Check the Error and Another problem is that FullUrl are Saved When work Code My 2nd Code :(  


            if (ModelState.IsValid)
            {
                if (account.file != null)
                {
                    string FileName = Path.GetFileName(account.file.FileName);
                    //Save files to disk
                    account.file.SaveAs(Server.MapPath("Uploads/" + FileName));

                    //Add Entry to DataBase
                    string conection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                    using (SqlConnection con = new SqlConnection(conection))
                    {

                        string InsertAccount = "Insert into tblUser (FirstName,LastName,EmailAdress,UserName,Password,UserImage) values(@fname,@lname,@emailadress,@username,@password,@Userimagepath)";
                        SqlCommand cmd = new SqlCommand(InsertAccount, con);
                        cmd.Parameters.AddWithValue("@fname", account.FirstName);
                        cmd.Parameters.AddWithValue("@lname", account.LastName);
                        cmd.Parameters.AddWithValue("@emailadress", account.EmailAddress);
                        cmd.Parameters.AddWithValue("@username", account.Username);
                        cmd.Parameters.AddWithValue("@password", account.Password);
                        cmd.Parameters.AddWithValue("@UserimagePath", "Uploads/" + FileName);
                        con.Open();
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }

                }

Could not find a part of the path 'E:\Projects\FBClone\FBClone\Account\Uploads\14494605_1912172235673452_6934911680009623037_n.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\Projects\FBClone\FBClone\Account\Uploads\14494605_1912172235673452_6934911680009623037_n.jpg'.

Source Error: 


Line 30:                     string FileName = Path.GetFileName(account.file.FileName);
Line 31:                     //Save files to disk
Line 32:                     account.file.SaveAs(Server.MapPath("Uploads/" + FileName));
Line 33: 
Line 34:                     //Add Entry to DataBase

Source File: E:\Projects\FBClone\FBClone\Controllers\AccountController.cs    Line: 32 


<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->
This Is My 2nd Code 
                // Set uploads dir
                var uploadsDir = new DirectoryInfo(string.Format("{0}Uploads", Server.MapPath(@"\")));
                // Check if a file was uploaded
                if (file != null && file.ContentLength > 0)
                {
                    // Get extension
                    string ext = file.ContentType.ToLower();

                    // Verify extension
                    if (ext != "image/jpg" &&
                        ext != "image/jpeg" &&
                        ext != "image/pjpeg" &&
                        ext != "image/gif" &&
                        ext != "image/x-png" &&
                        ext != "image/png")
                    {
                        ModelState.AddModelError("", "The image was not uploaded - wrong image extension.");
                        return View("Index", account);
                    }
                    // Set image name
                    string imageName = account.Username + ".jpg";

                    // Set image path
                    var path = string.Format("{0}\\{1}", uploadsDir, imageName);

                    account.image = path;
                    //Insert Value funtion
                    account.CreateAccount();
                    // Save image
                    file.SaveAs(path);
                }
            }

<!-- end snippet -->

            }

            return Redirect("~/");
        }