Image not show asp.net - html

If I run my webapplication the application work right. When I try to publish with the file system the images doesn't show. The images are included in project and in the publish folder I do find the images in the image folder.
but is does not show. There is no error, so I do not know where I had to look. Does somebody can help me with this? The image is a simple html tag.
<img src="~/Images/logo.png">

You can not mix ~ with non runat="server" control :
But you can do this :
<img src='<%= ResolveUrl("~/Images/logo.png") %>'/>
MVC :
<img src="#Url.Content("~/Images/logo.png" )"

Is it an ASP.NET webform project? If so, update it as follows:
<img src="~/Images/logo.png" runat="server" />

Here are two ways to set up your image. Either one should work for you.
<img src="/Images/logo.png" />
<asp:Image ID="Image1" ImageUrl="~/Images/logo.png" runat="server" />

Related

Localisation of Image

I am asked to do the localization of an old project. I did all the text part.
But I am stuck on Images.
<img id="img78" src="~/images/f1/step.jpg" runat="server" alt="image2" width="267" />`
This is one of the image tag I am struggling to fix. I have different images for German and French.
This is in a UserControl. I have 3 different resource file on the LocalResources folder of the UserControl. All text fields are working.
This is due in 2 days. Any help would be appreciated. I am new to programming. This project is done in old asp.net.
Is it possible to set the src from LocalResourceFile.
I tried the following way but didn't work:
<img id="img78" src='~/images/<%= GetLocalResourceObject("step1") %>/step1_2.jpg' runat="server" alt="image2" width="267" />
My ResourceFiles are Activate.ascx, Activate.ascx.de, Activate.ascx.fr
ResoucefileEntry :- (Name)step1.Text
(value)g1
I need to change the url for <img src=>
for German as `src="~/images/g1/step.jpg"`
for French as `src="~/images/f1/step.jpg"`
for English as `src="~/images/e/step.jpg"` This is the default.

Proper <img/> source for ASP.net project?

I'm having trouble understanding how to get images to display on this ASP.net project. I'm used to using tags, but am having trouble with the paths.
I have tried all of these solutions and none cause the image to display:
<img src="~/Images/mask.png" alt="Sample Photo" />
<img src="~/Images/mask.png" alt="Sample Photo" runat="server" />
<img src="../Images/mask.png" alt="Sample Photo" />
<img src="Images/mask.png" alt="Sample Photo" />
<img src="../Images/mask.png" alt="Sample Photo" />
The Images folder is in the project root. I'm using Bootstrap 4.0 and no other CSS.
If I set the src to a link (to Imgur, for example), the image displays. This makes me think it's an issue with the path, but I don't know what it could be. I think I've tried every variation that I came across when googling.
Any guidance would be really appreciated, and please let me know if I need to elaborate.
Place images in wwwroot folder.Details in documentation

ASP membership send registration HTML mail with image

i have ASP.NET site with membership provider. when the user is registered i send mail for registration compilation with .txt file (containing HTML). i trying to add image to this HTML. the problem is that i cant see any image in the mail. 'images' folder is under main site folder.
Confermation.txt file
<body style='text-align:right;font-family:arial'>
<div style='margin:0 auto'>
<img id="Image1" src="images/logo.png" style="width:350px;" />
<br />
please press the following link<br />
<br />
press here
<br /><br />
Thanks
</div>
ASP.NET
<asp:CreateUserWizard runat="server" EnableViewState="False"
DisableCreatedUser="True" ID="CreateUserWizard1" Width="300px
OnSendingMail="CreateUserWizard_SendingMail">
<LayoutTemplate>
<asp:PlaceHolder ID="wizardStepPlaceholder" runat="server"></asp:PlaceHolder>
<asp:PlaceHolder ID="navigationPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<CreateUserButtonStyle CssClass="btnRegister" Height="35px"></CreateUserButtonStyle>
<MailDefinition From="myemail#gmail.com"
IsBodyHtml="True" Subject="registration" BodyFileName="Confermation.txt">
</MailDefinition>
<WizardSteps>
why cant i see the image?
i tried also src="logo.png" and src="../images/logo.png" with no success.
you are adding html(browser type) coding in txt(simple text file) file. That can't be run or understand by browser. Use mail type html that can solve you problem

broken image in html page

Good day,
I am doing on Java with Struts2 framework. The below is my html code :
<html:image alt="Calendar" src="/images/icon_calendar.gif" />
<img alt="Calendar" src="/images/icon_calendar.gif" />
The first line of my image is working fine, the image is show correctly in my web page. ()
However, the second line of my html is not working. It is showing broken image in my web page. ()
Would like to ask, what mistake in my code.
Kindly advise.
Good day,
The problem is solved once I have post this question.
I have tried to solved it for few days.
The correct code should be as follow:
<html:image alt="Calendar" src="/images/icon_calendar.gif" />
<img alt="Calendar" src="images/icon_calendar.gif" />

adding / to internet address causes asp:Image not loading

My code:
<asp:Image runat="server" alt="not loaded" ImageUrl="picture.png" />
On site address
example.com/tabid/233/Default.aspx
everything works, but on address ("/" added)
example.com/tabid/233/Default.aspx/
my page looks like before but picture is not loaded. Does somebody can explain it to me and give an adive what to do to have picture always loaded?
If image in root u can map image like this.
<asp:Image runat="server" alt="not loaded" ImageUrl="~/picture.png" />
Default.aspx is your page and Default.aspx/ references to a folder. If you want to use / at the and, you can try routing or apply rewrite rules.
http://msdn.microsoft.com/en-us/magazine/dd347546.aspx
Change the "ImageUrl" attribute in the Image tag to something like...
<asp:Image runat="server" ImageUrl="~/picture.png" />
The extra "/" has the browser looking a folder deeper than it should be for the image.