using a ReportViewer to show my reports: I have a RDLC with a parameter for an external image path.
the image is saved on the server.
Parameter value =
"file:///" + Server.MapPath("~/images/img.png")
this works on all other browsers but on IE it does not, however, if I export to PDF the image is visible.
Any ideas why this could be?
PS: I also tried using the complete URL of the image to no avail.
tested image url by posting in on the browser, url is fine.
How about:
string imagePath = new Uri(Server.MapPath("~/images/img.png")).AbsoluteUri;
ReportParameter parameter = new ReportParameter("ImagePath", imagePath);
ReportViewer1.LocalReport.SetParameters(parameter);
ReportViewer1.LocalReport.Refresh();
Related
I am using Splash v2.3.2 and I am trying to render a page but it is not rendering everything. It won't render images or dynamically loaded content.
I am using my http://localhost:8050/ with script:
function main(splash)
local url = splash.args.url
assert(splash:go(url))
assert(splash:wait(10))
return {
html = splash:html(),
png = splash:png(),
har = splash:har(),
}
end
Here is a browser rendering:
Here is a screenshot of the Splash rendering:
I have tried to change the wait time and also tried to allow plugins. None of this will work. I am assuming that the dynamically loaded content is being restricted but I am unsure. Any help is appreciated.
The problem is with localStorage - site uses it, but Splash uses Private Mode by default, and this disabls localStorage. To fix it, disable private mode (see here). This script works for me (Splash 3.0):
function main(splash)
splash.private_mode_enabled = false
local url = splash.args.url
assert(splash:go(url))
assert(splash:wait(10))
return {
html = splash:html(),
png = splash:png(),
har = splash:har(),
}
end
See also: http://splash.readthedocs.io/en/stable/faq.html#website-is-not-rendered-correctly
I'm assuming that you are trying to scrape property description text. In your code you have just added splash:wait(10), My suggestion is you should try and implement wait for a specific css element. In you case, span#listingpropertydescription.
You can write a function to wait for this particular element and then return the html page.
Note you can find a sample wait-for-element code in http://localhost:8050/
Hope this will help you
I have a webpage which is trying to render more than 300 images, but IE is not rendering all the images. I have detailed the exact scenario below.
I have a aspx page with a asp:Panel. I'm adding new aspx pages to this panel,
Image image = new Image();
StringBuilder url = new StringBuilder();
url.Append(string.Format("ImageDisplay.aspx?Sample={0}", 1));
image.ImageUrl = url.ToString();
HtmlGenericControl div = new HtmlGenericControl("div");
div.Controls.Add(image);
this.pnlImages.Controls.Add(div);
the second aspx page writes the image to the response,
Response.Clear();
Response.BufferOutput = true;
string fileName = "..\\Sample.jpeg";
Bitmap image = new Bitmap(fileName);
image.Save(Response.OutputStream, ImageFormat.Jpeg);
image.Dispose();
Response.Flush();
likewise I'm adding more than 300 images.
IE is not rendering all the images properly, most of the images are getting broken and shows as 'X' sign. While the same page loads perfectly fine in Firefox and Chrome. I'm not able to find the cause of the issue since it only happens in IE. Could someone please help me with this.
May get some help here...
Multiple image handler calls causing IE to hang in pop-up window
Load images fail when I pick multiple image files in my metro style app
I have uploaded some images to Azure blob storage (sample) which need to be referenced from a ReportViewer.
Right now, i have an image control bound to the results of a stured procedure that lists a couple images based on some criteria. The SP is outputting the list of images correctly (the sample link being one of them) but all i get from the image control is an empty block wrapping an img with an empty src.
The behaviour is still present even if i hardwire the sample image link into the image control instead of binding it to the query results (Only difference being that i now get a proper image in the Visual Studio preview).
I have tried disabling all proxies, whitelisting my azure blob domain from the default proxy but have met no success.
Right now my app is running on my development machine.
Update:
Hardwiring the sample link into the image control somehow works now, but i am still facing the main issue: databinding the image control to a sp-produced value results in an empty src. Setting the image source to external and the image to [RValues] is still not working. (Setting a text control to [RValues] will output a valid absolute url pointing to the correct image so i doubt that's the problem)
Update 2: The image is showing as a red x on the PDF export
Your question has nothing to do with Windows Azure.
In order to reference external images into your reports you need to do a couple of things. First of all you have to enable external images in your report viewer control:
ReportViewer1.LocalReport.EnableExternalImages = True
Also you need to set the source as external. And last but not least make sure the reportviewer httpHandler is properly registered with the web.config.
For more information check the relevant question here and documentation here.
If you're using Azure Storage SDK to upload the blobs, you're probably not specifying content type. By default Azure Storage assigns application/octet-stream to them and serves them using this content type when you access the files via url. ReportViewer doesn't work well with external images served like that.
So when uploading the image, make sure to specify ContentType property of the blob.
var blockBlob = container.GetBlockBlobReference("your-image.jpg");
blockBlob.Properties.ContentType = "image/jpeg";
await blockBlob.UploadFromStreamAsync(stream);
public async Task SaveFile(byte[] bytes, string feature, string fileName, string tenant)
{
CloudBlobDirectory blobDirectory = GetImageStorage(tenant, feature);
CloudBlockBlob blockBlob = blobDirectory.GetBlockBlobReference(fileName);
blockBlob.Properties.ContentType = "image/jpeg";
using (var ms = new MemoryStream(bytes))
{
await blockBlob.UploadFromStreamAsync(ms);
}
}
I have a website on GoDaddy. All permissions are set correctly and the image DOES exist. However when the page loads the image for the item selected does not show. Here is my code
imagepath = "~/spaimages/" + currentSpaModel.Name.ToString() + ".png";
if (File.Exists(Server.MapPath(imagepath)))
{ this.spaimage.ImageUrl = Server.MapPath(imagepath); }
spaimage is an ASP control and thr URL that the image is set to is D:\hosting\xxxxxxx\calspas\spaimages\modelname.png
What am I doing wrong.
The file path D:\hosting\xxxxxxx\calspas\spaimages\modelname.png is the folder where the image resides on the web server. You are sending this as the <img> tag's src attribute, which tells the browser, "Go get the image at D:\hosting\xxxxxxx\calspas\spaimages\modelname.png." The browser cannot go off to the D drive of the web server, so it looks on its own D drive for that folder and image.
What you mean to do is to have the <img> tag's src attribute be a path to a folder on the website. You're just about there - just drop the Server.MapPath part when assigning the image path to the ImageUrl property. That is, instead of:
this.spaimage.ImageUrl = Server.MapPath(imagepath);
Do:
this.spaimage.ImageUrl = imagepath;
See if that works.
Thanks
Often, if an image "does not show" (I assume a red-x-equivalent is being displayed to show "broken image"), I right-click the broken image, copy the URL and open the URL in a separate browser window.
This way, when the image is being generated by some script, I see any error text that the script might have shown. If not, the real image would be displayed.
In addition, add an else block to the
if (File.Exists(Server.MapPath(imagepath)))
like
else
{
Response.Write(string.Format(
"File does not exist at '{0}'.",
Server.MapPath(imagepath)));
}
For debugging purposes.
i open a web application in visual studio 2008...
it contain the tree view properties as,
TreeNodeType type;
type = new TreeNodeType();
type.Type = "folder";
type.ImageUrl = "Images/" + "folder.gif";
type.ExpandedImageUrl = "Images/" + "folderopen.gif";
i dont know how this image tag comes.. and how to chage that...
If your image directory is in the root of the application you should use the tilde character '~' at the start:
type.ImageUrl = "~/Images/" + "folder.gif";
you should include the full path to the image from the root, so if the image is in Content/Images:
type.ImageUrl = "~/Content/Images/" + "folder.gif";
At runtime, the '~/' is translated to the correct path to the image and rendered to the page.
If this is not working, you need to post the relevant markup of the page and the codebehind. Alos, it would help if you rightclick the image in IE and slect properties. You can see the expected path there. Or open the page in Firefox, with the Firebug Addon installed, right click the image and select Inspect Element. This will show you the path that was rendered and you can compare this to where the image actually is in your project.