I have an Asp.net MVC 5 website that hosts a RDLC file. I want to call a controller action to render an image in the report. The Image control has "External" image source set. I have tried passing the URL as a parameter to the report and setting the image expression to that parameter. The image is blank. The HTML in the browser states "src=unknown". I have also tried hardcoding the expression. No image displays. When I put the URL in the browser, the image displays. The hardcoded URL is ="http://localhost:55426/image/showbarcode?id=69899694-6ce4-e811-80cc-78e3b50d083e". The website is not hosted in IIS. No errors are reported
This is the only report that is using external images. I did have to change the SSRS target server version to "SQL Server 2008 R2, 2012 or 2014". All the other reports render fine.
My coworker changed the report to get the image from the database. That fixed the problem.
Related
MVC 4 website developed in .net 4.5, vs 2012 express on win8
it works fine on local-host
but deployed on web (see link) have many errors
not all image get rendered
CSS font not working properly.
when i click logo in HTML source it give mi 404 not found (all resources are present some get renders and some not)
Have you checked all your MIME types in IIS to ensure that you're able to serve .PNGs? Just checking...
Which CSS font are you referring to?
To brief our problem, i am using MVC Application by default created by VS, only thing i have added image folder have one logo image.
I am using this image in site master as a logo path i am using to access it ../../Images/logo.png.
This logo image gets loaded in debug mode vs 2010 but when i publish it in local host iis 7.5 it does not get loaded. while clicking on error it shows different path.
Although above things works at my shared server.
Thanks, i have googled alot and find some tips over some page, here is the remedy
I used src='<%ResolveUrl("../../Images/logo.png")%>' and it is working fine
I am unable to show images in CR reports. I'm developing a MVC 2 project in VS 2008 with Crystal Reports that comes with it (10.5). Everything works fine, except for images. I can see them in the preview mode within the CR designer, but not when the app is deployed, which means I am loading data OK but something's wrong with IIS and/or routing.
When running the app, images appear with the red cross and if I navigate to the following url directly I get a 404 error.
http://localhost:1234/CrystalImageHandler.aspx
I think my problem is similar to the one here but that workaround doesn't seem to work for me.
I should also comment that I'm using the Areas feature within MVC.
EDIT: Forgot to add: When exporting the report to PDF the images are shown ok.
I don't know much about crystal reports, but is there an Http Handler? If there is and you are running IIS 7 on the live server, is the handler registered in the web.config under both system.web/httpHandlers and under system.webServer/handlers?
I forget to register the handlers under system.webServer/handlers for our IIS 7 server sometimes and we were having a similar issue with the Microsoft Charting Controls.
I am developing an ASP .Net MVC application and on my dev machine, the application runs as expected and, more importantly, the images mentioned in the CSS file are displaying correctly too.
However, when I publish this application to a testing server, the web app runs fine, but the images are not shown.
If I modify the URL in IE when testing the output from the test server, the image is returned, meaning that the file is there but it just won't appear within the view page when using the site normally.
I have tried alternative servers too, but the result is the same.
To confirm, here's a line from the CSS page referencing the image...
background-image: url('/Content/Images/Logo/myLogo.jpg');
Any suggestions?
Cheers
Brett
The URLs are not correct, likely due to the fact that you are publishing in a subfolder and so they are no longer at the root of the server. I usually use Url.Content( "~/Content/Images/..." ) to build the url instead of hard-coding it. That way it will take into account the routes when building the path.
Example:
<img src='<%= Url.Content( "~/Content/Images/banner.jpg" ) %>' alt="Banner" />
I had the same issue, but I found the reason why it was forcing authentication on the Contents folder.
When a user is not logged in yet, they are classified as Anonymous Authentication. In IIS7 (which is what I am using, guessing it is the same in IIS6) you need to open the authentication window in features view. Then edit the Anonymous Authentication, to use your application pool identity, or the default one, just make sure that user has permissions to read in that folder.
That fixed it for me, hope it works for you.
Possible relative paths are wrong...Possible that they are wrong for CSS file itself. You can use FireBug to see if CSS loaded correctly, then you can examine image request, often in such situations you will see red(error) items. This could help to localize problem.
I am using Silverlight 3 beta and Visual Studio 2008 SP1 for this.
In the web application (Server side) I have a HTTP handlter ImageFetcher.ashx which expects an ID parameter from the query string and retrieves the data from database and writes it to output stream. This is working fine and I have tested it with a test aspx page adding a image control with src=ImageFetcher.ashx?id=44.
I also have a silverlight client navgatoin application in the same solution. I have the following image tag in my xaml
<Image x:Name="myImage" Width="400" Height="300" Stretch="Uniform" Source="/ImageFetcher.ashx?id=44"/>
When I run this app, it fails to retrieve the image. When I debugged the handler, I noticied that it is not getting any querystring parameter. if the change the image tag to use absolute URL as below it works fine again
<Image x:Name="myImage" Width="400" Height="300" Stretch="Uniform" Source="http://localhost:5573/ImageTest/ImageFetcher.ashx?id=44"/>
But I cannot use the absolute URL, what is wrong here? why the relative URL does not carry the querystring correctly to the server side?
Thanks
Shreedhar
I posted on Silverlight forums as well, but I'll copy it here too.
A relative URL is relative to the XAP - which is loaded on the client machine. Once the XAP is downloaded to the client, the loading ashx page will no longer be relative to the XAP and will therefore not be found. Once you make the url absolute, you are telling it to look on your local host [the exact location] for the loading page.