Showing posts with label resource. Show all posts
Showing posts with label resource. Show all posts

Friday, March 23, 2012

image resource returned in code

I'm trying to display an image that has been returned from an external assembly, but am having no luck at all.

Essentially, I have a utility class that goes to a resource file and pulls out a JPG and returns it. I have set the value property of the image control on the report to hit this assembly, like so :

= Code.getLogo()

where the function Code.getLogo() actually interfaces with the utility class.

I have tried several variations of this code. I have returned the image as an Image object, a JPG, a TIFF and a BMP. I've also been adventurous and tried converting it to a base64 string before it gets to the report and then having the report convert it back to bytes before shoving it into the image value. Consistently I get this error :

The value expression used in image ‘logo’ returned a data type that is not valid.

A reply to a similar post on the www.sqlreportingservices.net site suggested that it's a Code Access Security issue, but I'm sure it's not, because when I dump my base64 string into a text field, it fills half the page.

What is this control expecting? Any thoughts?

Have you tried setting Image.Source to Database? If you specify Embedded, the value of Value is the resource's name embedded in the report, not the image's binary data. If you specify External, it is expecting a URL path to the image. Specifying Database indicates that the image contents is coming from a database field and Value is then the image's binary data. It's not actually coming from the database in your case, but Image should interpret the Value properly all the same.|||

Yes, I did indeed have it set to Embedded.

When I set to Database, I have a whole new set of errors, but they seem more straightforward. I'll fiddle with it for a while and see what I can come up with.

Got me over a big hurdle. Thanks.

|||Next you'll want to make sure your MIMEType is set correctly. If you're returning JPEG data, you want to set your MIMEType to image/jpeg. If you have a mismatch, it will try to interpret your JPEG as a BMP (i.e. MIMEType = image/bmp) rather than the JPEG that it actually is.|||

Your function has to return the image as byte array (i.e. byte[]). In addition, the image type has to be set to "Database", otherwise the Value property is not interpreted as the actual image data.

--Robert

|||Awesome, it worked. When I changed my Source property to Database, I also took out my conversion statements so that it would return just an image file. Once I put the conversion-to-byte-array logic back in, it worked.

Thank ye very much for your help.

Wednesday, March 7, 2012

IIS 405 Resource Not Allowed

I have several Reports that when I Click on the "View Report" button I
receive a 405 Resource Not Allowed Error. I have re-installed Report Server
and updated to Service pack 2 for Reporting services, with no change in the
outcome.
The Initial load of each of these reports works fine, however when I change
the condition dropdowns or "View Report" I recieve this error.
The problem first started when the Default Directory under IIS was
accidentially deleted and then re-created.
Any assistance would be appreciatedHello,
Go to IIS, right click on your web server, click on configuration button, go
to .aspx -->Edit
and be shure that on the verbs section you have the POST
hope this can help you|||rectification about my previous post:
under IIS go to the virtual folder "ReportServer" , click on the
"configuration" button .
Under the "App Mappings" tab look if you have the extension *, if it's not
the case you have to click "Add" and browse on the "Executable" field to find
aspnet_isapi.dll (c:\winnt\Microsoft.Net\framework\v1.1.4322).
On "Extension" field write * and on the verb section select "All verbs"
And that's it|||This is valid only for IIS 5.
Under IIS 6 you must insert
"c:\windows\microsoft.net\framework\v1.1.4322\aspnet_isapi.dll" filter under
"WillCard application Maps".
Bye.
"Wjm" wrote:
> rectification about my previous post:
> under IIS go to the virtual folder "ReportServer" , click on the
> "configuration" button .
> Under the "App Mappings" tab look if you have the extension *, if it's not
> the case you have to click "Add" and browse on the "Executable" field to find
> aspnet_isapi.dll (c:\winnt\Microsoft.Net\framework\v1.1.4322).
> On "Extension" field write * and on the verb section select "All verbs"
> And that's it