Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
how can i store an image from .aspx page in a image variable in code behind file(aspx.cs) file
Posted

Use ASP.NET Image Control

On aspx page,
ASP.NET
<asp:image id="Image1" runat="server" ImageUrl="/images/abc.png"/>

For aspx.cs
C#
string imagePath = Image1.ImageUrl;


You can get other properties of that image too :)
 
Share this answer
 
v2
try this way

C#
var img=System.Drawing.Image.FromFile("FILEPATH");
 
Share this answer
 
v2
you need to set the property named ImageUrl to show an image
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900