ASP.net MVC 4 images load locally but not online - asp.net

So I am currently working on a website where the images are hosted in the following location.
www.website.com/resources/images/products/imagename.jpg
when I type in the following url this works.
localhost:50836/resources/images/products/imagename.jpg
The following doesn't work and gives me a 404 error
www.newurl.com/resources/images/products/imagename.jpg.
I have logged into the ftp to make sure that the images are there are in the order of:
projectname/resources/images/products/imagename.jpg
I am currently working on redoing their site, taking nothing from the old site except the images. On the new site I have put the resources folder in the same location. However when I try and view the image on the new site I get a 404 error. It is important that the images are in the same location because the images are used in other locations.

I had to add the following code to the Web.config in order to allow the images to be accessed.
<bundle virtualPath="~/resources/sample" transform="System.Web.Optimization.JsMinify, System.Web.Optimization">
<content>
</content>
</bundle>

Related

Cannot find project pages after publishing on server (Razor Pages)

I have a serious problem that I can not find the cause.
The project works well when running on localhost and without any problems.
But since I published in server it, it does not find some pages in the server .
Like the photos below
Look at this photo of the bar that can not find the path of the entered page.
This is a local host photo that has found the page well
This is my routing system in startup.cs
Server with plesk control panel
Is there a problem with the server?
It's a bit late, but I had the same issue with Index page, and found out that in .csproj file there was something like this and <_ContentIncludedByDefault Remove="Pages\Index.cshtml" /> and after removing those lines everything worked perfectly.

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.

Serve images from an alternate location without exposing the location using url re-write

On my asp.net site running in IIS7 I want any images, css and scripts (\.js|\.css|\.jpg|\.png|\.gif)$ on the HOME page to be loaded from a sub-domain, but for reasons I won’t go into I want them to appear to come from the original source location.
For example an image on the home page with a source of
http(s)://www.mysite.com/some-directory/image.gif
should actually be served from
http(s)://hidden.mysite.com/some-directory/image.gif
but as far as the requesting browser is concerned it should appear to come from the original source location.
Any scripts coming from googleapis.xxx should be excluded, as should any images from /images(.*)
Can this be achieved with url rewrite rules, if so how?

Flex HTML Post Error - Security Problem?

I have a swf that I have created that make a few HTML posts. When I run and compile the swf locally, it successfully makes posts to my php code hosted on my domain. However when I then upload my swf to my domain, and then alter the embed tag to have a fully qualified path to my hosted swf, the swf will load correctly but it will make any HTML posts to my PHP scripts. The reason that I have an an embed tag with the fully qualified url in it, is that my goal here is to be able to place the html embed code on a number of different sites.
I have it working on a single remote site, and it has a wild card crossdomain.xml file in it. However when I try to apply a crossdomain.xml to any of the hosted sites, or to my computer locally nothing runs when the I use the embed with the fully qualified URL, if I just the locally hosted swf on my computer the HTML post work just fine.
I feel this is related to the crossdomain.xml file, however I guess I'm not understanding some aspect of the security model.
So my goal is to be able to paste the embed HTML code with a fully qualified swf (for example, "http://www.abc.com/myswf.swf") on a number of other sites and have it make standard HTML posts to my home site (http://home.com).
Thanks for any help on this one. I'm soooooo close, like I said I got it working on one remote site, but I'm not sure how. All other sites I post the embed code fail.
Ok , I'm editing my answer , following the examples you've just given.
According to the error report I get , the problem is with an ExternalInterface call that's not allowed from the swf to the site hosting your swf.
It works in the second example because the call is made within the same sandbox.
Taken from the docs:
SecurityError — The containing environment belongs to a security sandbox
to which the calling code does not have access. To fix this problem,
follow these steps:
In the object tag for the SWF file in the containing HTML page,
set the following parameter:
<param name="allowScriptAccess" value="always" />
In the SWF file, add the following ActionScript:
flash.system.Security.allowDomain(sourceDomain)
You may also have to check the allowNetworking parameter in your embed code...

Error SiteMap

What is this error when I SiteMapPath and Configure whit siteMap.of course when I upload my website,I showing this error : "The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
"
What Do I do that SiteMap work correctly ?
Here is a critical question and something to try:
Does the website work on your development machine?
If it does work then check the url for the pages in the SiteMap. If the URL for the pages in the SiteMap reference a physical directory such as "C:\mySite\MyPage.aspx" then that is the most likely cause. You want to ensure that the URLs refernce the page location through a relative path like "~/MyPage.aspx".
If it does not work, then verify that there are no typing errors in the URLS. Once you getting it working on a local development environment using relative paths then the chance of it working on a remote machine should go up considerably.

Resources