Why have my pictures disappeared (404) in a previously working website? - asp.net

I created a IIS website about a year and a half ago with a lot of pictures on various aspx/asp tabbed pages. My development PC is Windows 8.1 Pro with IIS version 8.5.9600.16384 website. The website was developed using Visual Studio 2012. The website was published onto the same Windows PC.
The published website was then copied onto a Window Server 2012R2 on an IIS Version 8.5.9600.16384 web and worked well. Gradually search engine bots found the site and all was well.
This week I went to make some updates to the website and found none of the pictures working. They are all returning a 404 html code. When I view the .jpg files individually from IIS Firefox returns "cannot be displayed because it contains errors". Chrome and Edge both say the file can't be found. If I view these files from Windows File Explorer they look fine.
So I deleted the files on the server and then copied the published website from my development PC. Still no pictures.
I have another similar web application on the same server so moved one of the jpg files to that directory and tried to view it via IIS - still 404. I copied a picture from the other website to my "broken" directory and the other picture was viewable via IIS. All of these pictures were reduced in the same manner using Photoshop 7.0.
I went back to my development PC and viewed the original website via IIS. The pictures were viewable so I republished the website, copied it to the server - no pictures.
I then found the original picture (not reduced) and moved it to the server. Still 404.
My problem doesn't seem to be permissions because I can view pictures copied from another web to that directory.
The website had been working for over a year but the pictures now return 404's.
The pictures can be viewed on the development PC using IIS but not after publishing them and then copying the website to the server.
Another website with essentially the same code with pictures reduced in the same manner is displaying pictures fine.
I'm really perplexed and would love to hear some of your ideas as to what might be my problem. Thanks for taking the time to read this.

The first place I always start with missing images is to View Source and make sure the path to the image is actually what I think it is.
Could you have done something so the path is now built relative to the machine's file structure instead of relative to the site? That could cause the image to be found locally, but not on your server.
It might be easier for someone to get an idea if you included the URL so we could examine the page displayed.

I'm pretty sure I figured out the problem but it leads to other questions.
I shortened the filename and now I can browse to it via IIS.
So here are my current questions:
Why had the pictures been browse-able originally but not now? Has there been some kind of internet change about acceptable file length? Or possibly some kind of Server 2012R2 update that caused this change?
Why are these pictures browse-able on my Windows 8.1 PC via IIS but not on the Server 2012R2? I can also open the website and see all of the pictures on Windows 8.1.
It's nice to have tackled one problem but I would still like to know the cause if anyone should have any suggestions.

I FINALLY figured out why my pictures disappeared. Yes renaming my .jpg files did fix the problem but that wasn't the cause. The problem was that I had added /2018, /2019 and /2020 to my IIS Request Filtering denied. All of my picture files had dates on them. When I renamed/shortened the file names I removed the /year. Phew! The stupid things I do! This also explained why I could view these webpages on my development PC but not the server - no request filtering. Hopefully my error helps someone down the line.

Related

Webmatrix - upgraded, now cannot browse localhost sites

I am in the process of developing an ASP.NET site. Yesterday it was working fine. I then upgraded WebMatrix as I keep getting pop ups.
Now, when I try to browse to my site all I am getting is the website text, no CSS, no functionality just plain html text.
No links are working but when I try to enter something into the search bar and hit enter I get the following:
Firefox doesn't know how to open this address, because the protocol
(localhost) isn't associated with any program.
You might need to install other software to open this address.
Now I investigated this and found a this topic:
IIS, IE does not recognize web page protocal
And yes when I added the http and copied the address into IE it brought up the correct page. However then when I tried to navigate around I got the same problem in IE with the message:
No apps are installed to open this type of file (localhost)
I'm totally baffled so any advice would be really appreciated.

Running Classic ASP site on IIS7.5

I've tried everything I can think of (and read online) and hit a brick wall.
Bought a new PC, Windows 7 and turned on IIS7.5 and Classic ASP. Downloaded my classic asp site and database (an Access database - yes I know, Access!). I downloaded my whole site wwwroot for local developing and testing.
Any asp page residing in the top level directory (localhost/index.asp) runs fine in the browser. But click on a link to any page within a directory (eg localhost/blah/index.asp) gives me a 404 error.
The files are DEFINATELY there. If I create a simple test asp page and place it in a directory, it works fine in the browser. And it's not a coding issue - the site works online and on my old XP machine.
Could it be to do with permissions of the files and folders when they were downloaded (BTW, I tried downloading via filezilla and FTPrush, but it made no difference). I'm no expert on PCs, and I've already experienced a few problems with permissions (and I'm logged into PC as Administrator)
Any ideas please?
So are the files based in c:\inetpub\wwwroot\blah? Does c:\inetpub\wwwroot\blah\index.asp exist?
Try giving IISUR and IIS_IUSRS admin access over the folder and its contents.

Changes in aspx and ascx-files not showing

I have a problem with caching of aspx and ascx files in one of my web applications on localhost (windows 7). If I make changes to one of these types of files, for example changing a hardcoded text, no browser picks up this change. I have tried ctrl+f5, and clearing the browser cache. Recompile doesn't help either since no code changes has been done. The only thing that helps is resetting IIS.
I have another web application running on the same IIS instance, where I don't experience this behavior. However, I can't figure out what the difference between those two applications is. I don't publish any files, the IIS sites are pointing directly to the files I edit in Visual Studio.
Any ideas?
For some reason this fixed it self when we went from Subversion to TFS this week.

strange issue with publishing website (the images don't show up after publishing)

I developed a website in ASP.Net 3.5. When I compile it with Visual Studio on the HOST Machine, the website shows up correctly! But when I publish the website to the host machine's website hosting folder, type the navigate to the site in the IE, it shows up this way:
the images do not show up
fonts are not recognized
Does anyone have any idea what could be the issue?!
I mean the same Host Machine! Same IE (version8)! Compiling it with Visual Studio 2008 on that machine, every thing is fine, but when calling the published site on the same host machine by typing the URL in IE, the images don't show up and the fonts are not recognized.
Images/fonts not showing up is a sign that your relative paths are off. One common cause of this is forgetting to creating the IIS application when you deploy. If you don't create the application, then image paths written like this:
~/content/images/img1.jpg
will be broken. (They'll resolve to mydomain.com/content/images/img1.jpg instead mydomain.com/myapplication/content/images/img1.jpg.)
Another possibility is that your relative paths are written like this:
/content/images/img1.jpg
This type of link will always be broken if you deploy to any sub-path within a domain. Ie, if you deploy to mydomain.com then the links will be good, but if you deploy to mydomain.com/myapplication, then URLs written like the above will resolve incorrectly as mydomain.com/content/images/img1.jpg.

Image Not Shown In IIS7

I faced some problems after hosting my web project in IIS 7 / Windows 2008. Images are not shown when I run the project on my browser.
I copied my project folder (webtest) to c:\inetpub\wwwroot\. To be sure, I chose image from webtest\image\sample.jpg again. It works properly when I run it. However, after putting up for hosting and I call it from browser it doesn't show the image.
What are the possible causes of the problem?
Possible solution is to add .jpg/.jpeg mime type in IIS Manager if it doesn't exists.

Resources