I am totally agree with Sergery. This is "Not a good practice". In case of that, you can store the files in folder and store the url in database. While displaying, you can take image path from database and assign it to Image URL. See example:
how to save images into folder and images path in database and display images from folder in gridview based on images path in database using asp.net[
^]
see your temporary solution:
If username is unique, the images will store with unique name. All you'll have to do is, search the file with username and assign the path as URL of image. Try this:
protected void Page_Load(object sender, EventArgs e)
{
string username = (string)(Session["UserAuthentication"]);
if(Session["UserAuthentication"]!=null)
{
Label2.Text = username;
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Images/"));
string path = filePaths.AsEnumerable().Where(s => s.Contains(username)).First();
Image1.ImageUrl = path;
}
}
--Amit