not getting images displayed after uploading asp.net application - asp.net

hai,
i am getting the images in my localhost.But when i am uploading my project the images are not displayed.
I am saving my images in "~/App_Themes/darkOrange/images/button_line.jpg".
Is their is another method for giving image path in ASP.Net.
please help.
thank you.

Yes - check what is actually getting rendered out in the "src" attribute for the images. See if you can physically get to that file, if you cant, means the webpage cant. Have you confirmed the images have been deployed to the web server (not local - the server you uploaded to).
If not, make sure the "Build Action" for the images are set to "Content" in the properties window in Solution Explorer.

I faced a similar problem once. But, that was just a static website. Where the images were displayed in localhost but when I ftp files to the server, the images wouldn't show.
Later, I found out that it was becasue of the different case. For e.g - The image file name was "Image.JPG" and I had used "Image.jpg" in my code
Just check if this helps.

Related

FlowRouter locally served images break after redirect

While using FlowRouter if I load my page any locally served images (images/myImage.png) works fine. But if I navigate to a page and then navigate back (home page -> about page -> home page) the image is broken. However in the developer console, if I hover over the image source, the image appears fine.
This is not an issue with images served from another server.
Update
I never solved this issue, but because this still seems to be an issue with many people. I'm posting my work around. Based on the Meteor communities advice, I switched to cloud based image hosting like Cloudinary or AWS
It sounds like you are sometimes accessing images using their file paths. With Meteor, to serve static files properly, they need to be in the /public folder of your project. So you should put them in /public/images, and then reference them according to the following example:
The file
/public/images/foo.png
is displayed by
<img src="/images/foo.png>
See here: https://guide.meteor.com/structure.html#special-directories
I realized that although my images worked with the following:
Image is in /public/images/name.png
<img src="images/name.png">
But then I changed the url to:
<img src="/images/name.png">
Now it works and doesn't break.

Background image stops working when uploaded to server (website)

I'm new to all this and I'm having a pretty annoying issue.
My site works fine when I open it from the folder on my PC but when I put my site online all the images stop working. I have uploaded the image folder and all the images I made sure.
I'm using bootstrap and bootstraps basic template.
The image file names had capitals in them and obviously the FTP server is case sensitive where as Windows is not.
Thanks though guys.

css and images not loading

i have uploaded my asp.net 4 web forms site to my testing server. all the database connectivity issue is resolved and its working perfctly but i am having problem the css and the images are not showing neither localy on the server nor if i try to access it from the external link.
i am using master pages. (if this help in anyway )
i have tryed to hard code the styles into a page. they have appeared i think there is something with the path on server i have to create
i have double checked the css path and the images path they are correct but still they are not showing. any idea?
Thank you 4 the help
I had the same problem two minutes ago. Here's the solution.
All you have to do is run ‘optionalfeature’ command and make sure ‘Static Content’ option is checked.

CSS images not showing in ASP.NET MVC

In my ASP.NET MVC application, I am referencing background images via CSS. When I run it in the dev environment, they show up fine. But when I deploy it (using IIS 7.5) the images do not load at all. I have tried every combination of relative paths and background/background-image CSS tags, but nothing works. Here is my file structure and CSS:
File structrue:
Content
CSS file
images
image.png
CSS:
background-image: url(/images/bsb_header2.png);
I have also tried ../images/bsb_header2.png and ../../images/bsb_header2.png to no avail.
What is really strange is when I try to go to the image directly (i.e. www.website.com/images/image.png), I am redirected to a login page. Perhaps there is some access or security setting I'm missing? I haven't done anything with login controls yet (the default account view and controller are in my project but I haven't done anything with them yet) and I can view all my other pages just fine.
Update: I FINALLY figured it out. The image file in question was encrypted. Right click the image file and navigate to properties, click the advanced button on the general tab, uncheck "Encrypt contents to secure data", click OK, OK.
The tip off finally came when I noticed the file name was green in Windows Explorer. I see green file names all the time with no problems so I didn't think anything of it. Then I noticed it was the only green file in the entire web app folder. Put two and two together and it worked instantly. Thanks everyone for your help.
Please Add two users
IUSR,
IIS_IUSRS
to the publish folder and assign permission for them to read & execute
I FINALLY figured it out. The image file in question was encrypted. Right click the image file -> properties -> advanced button on general tab -> uncheck "Encrypt contents to secure data" -> OK -> OK.
The tip off finally came when I noticed the file name was green in windows explorer. I see green file names all the time with no problems so I didn't think anything of it. Then I noticed it was the only green file in the entire web app folder. Put 2 and 2 together and it worked instantly. Thanks everyone for your help.
Is it possible that IIS 7.5 was not installed correctly?
If you go to Turn Windows Features on or off - under:
Internet Information Services /
World Wide Web Services /
Common Http Features
there is a Static Content checkbox
is it checked?
see this link for screen-shot.
in css set "display: block"
.searchbtn
{
margin-top:-15px;
background-image:url(../images/icons/search.png);
background-repeat:no-repeat;
width:18px;
height:18px;
display: block;
}
The URL should be relative!
background-image: url(images/bsb_header2.png)
From your description, it appears as if the Request for the .png is getting routed to the ASP.NET/MVC engine instead of being served up by IIS.
Is it possible that the routing rules in the Global.asax are picking .png files? (I know this doesn't explain why it works in your dev environment).
Does it work if you add a ignoreRoute for .png files at the beginning of your route list in Global.asax? Something like below...
routes.IgnoreRoute("{resource}.png");
Had the same issue and finally found a solution.
In IIS open "Authorization Rules".
If there is nothing there, click "Add Allow Rule"
Choose "All Users" and hit OK

Image shows up in Design Preview, but not Application

I have some strange behavior.
My embedded images show up in the Flex Builder Design Preview, but are not displayed when the application is run. The images have relative paths (/assets/images/...), and the application is run on the server (wamp). I've appended the path to the compiled location (http://localhost/...) and tried to display a image in the browser, and the image exists, too.
I've compiled it via FlashDevelop, Flex Builder, and Ant. I've deleted and remade the bin/bin-debug/release/bin-release files to no avail.
Anyone run into this problem before? Thanks for any help!
Try using httpfox extension to debug the application requests, there you would be able to see the images path in the server.

Resources