if (FileUpload1.HasFile)
{
string savePath = Server.MapPath("~/memberspic/");
string fileName = FileUpload1.FileName;
string pathToCheck = savePath + fileName;
Random rm = new Random();
TextBox txtpass = new TextBox();
txtpass.Text = rm.Next(257871, 498371).ToString();
Guid g = Guid.NewGuid();
string extension = Path.GetExtension(FileUpload1.PostedFile.FileName);
FileUpload1.SaveAs(Server.MapPath("~/memberspic/") + "img_pk" + txtpass.Text.ToString() + extension);
string te;
te = "~/memberspic/" + "img_pk" + txtpass.Text.ToString() + extension;
impath = pathToCheck;
cmd.Parameters.AddWithValue("@ProfilePicture", te);
}