How to get webimage without knowing the file extension

230 Views Asked by At

I am using ASP.Net MVC 5 WebImage helper, I try to get a image like the following

var image = new WebImage("~/Content/Temp/" + user.id + ".jpg");

this only works when the file extension is jpg, how do you get the image if you are not sure what the file extension is, I also tried to use:

var image = new WebImage("~/Content/Temp/" + user.id + ".*");

but * is a invalid character.

0

There are 0 best solutions below