Server.MapPath
gives you local path to the file. While what you really want is the relative to the application root path (on the server!). For this what you already have, ~/Images/EmpQr/
is fine, so just append file name to it:
img_res.ImageUrl = string.Format("{0}{1}.PNG", "~/Images/EmpQr/", int.Parse(Session["userID"].ToString()));
Update. Out of curiosity, after discussion in comments, here is the relevant part of Image
control source code, which proves that url in form of ~/Images/...
will be handled correctly:
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
string text = this.ImageUrl;
if (!this.UrlResolved)
{
text = base.ResolveClientUrl(text);
}
if (this.RenderingCompatibility >= VersionUtil.Framework45)
{
if (!string.IsNullOrEmpty(text) || base.DesignMode)
{
writer.AddAttribute(HtmlTextWriterAttribute.Src, text);
}
}
else
{
if (text.Length > 0 || !base.EnableLegacyRendering)
{
writer.AddAttribute(HtmlTextWriterAttribute.Src, text);
}
}
//...