473,320 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Image data in profile: 28 bytes unaccounted for?

Hi,

I'm using the ASP.NET 2.0 profile system to keep an image of members of my
website "MyWebsite".

Initially, I've created the property in the web.config like:
<add name="Photo" serializeAs="Binary" type="System.Byte[]" >

Doing so, the binary data was saved in the "PropertyValuesBinary" column in
"aspnet_profile".

Now I need to query the "aspnet_profile" table from another website,
"MyOtherWebsite", and I want to read the image-data.

Therefore, I've altered the profile property like:
<add name="Photo" serializeAs="Binary" type="System.Byte[]"
customProviderData="image"/>

Now the binary data gets saved in a new column "Photo" in "aspnet_profile".

In "MyWebsite", the image data is correctly read by Profile.Photo.
In "MyOtherWebsite", the image data is queried by SQL (DataTable) but when I
read the column "Photo" from "aspnet_profile" the binary data is 28 bytes
longer than the binary data returned by Profile.Photo.

How do I get rid of those extra 28 bytes?

Kind Regards,
Roel
Dec 20 '06 #1
2 3296
profile stores a serialized byte array, not just the data. use the
binary deserializer to read the column.

-- bruce (sqlwork.com)

Roel wrote:
Hi,

I'm using the ASP.NET 2.0 profile system to keep an image of members of my
website "MyWebsite".

Initially, I've created the property in the web.config like:
<add name="Photo" serializeAs="Binary" type="System.Byte[]" >

Doing so, the binary data was saved in the "PropertyValuesBinary" column in
"aspnet_profile".

Now I need to query the "aspnet_profile" table from another website,
"MyOtherWebsite", and I want to read the image-data.

Therefore, I've altered the profile property like:
<add name="Photo" serializeAs="Binary" type="System.Byte[]"
customProviderData="image"/>

Now the binary data gets saved in a new column "Photo" in "aspnet_profile".

In "MyWebsite", the image data is correctly read by Profile.Photo.
In "MyOtherWebsite", the image data is queried by SQL (DataTable) but when I
read the column "Photo" from "aspnet_profile" the binary data is 28 bytes
longer than the binary data returned by Profile.Photo.

How do I get rid of those extra 28 bytes?

Kind Regards,
Roel

Dec 20 '06 #2
Thanx Bruce!

I've used this code to deserialize the byte array:

private byte[] DeserializeImage(byte[] image)

{

byte[] buf = image;

MemoryStream ms = new MemoryStream();

ms.Write(buf, 0, buf.Length);

ms.Seek(0, 0);

BinaryFormatter b = new BinaryFormatter();

return (byte[])b.Deserialize(ms);

}

This does the trick!

Kind Regards,
Roel

"bruce barker" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
profile stores a serialized byte array, not just the data. use the binary
deserializer to read the column.

-- bruce (sqlwork.com)

Roel wrote:
>Hi,

I'm using the ASP.NET 2.0 profile system to keep an image of members of
my website "MyWebsite".

Initially, I've created the property in the web.config like:
<add name="Photo" serializeAs="Binary" type="System.Byte[]" >

Doing so, the binary data was saved in the "PropertyValuesBinary" column
in "aspnet_profile".

Now I need to query the "aspnet_profile" table from another website,
"MyOtherWebsite", and I want to read the image-data.

Therefore, I've altered the profile property like:
<add name="Photo" serializeAs="Binary" type="System.Byte[]"
customProviderData="image"/>

Now the binary data gets saved in a new column "Photo" in
"aspnet_profile".

In "MyWebsite", the image data is correctly read by Profile.Photo.
In "MyOtherWebsite", the image data is queried by SQL (DataTable) but
when I read the column "Photo" from "aspnet_profile" the binary data is
28 bytes longer than the binary data returned by Profile.Photo.

How do I get rid of those extra 28 bytes?

Kind Regards,
Roel
Dec 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
2
by: zhaounknown | last post by:
I have a field set to Image data type, and store a long string(possible other objects)into it with size 5663, and returned with 5663+28 bytes. These strings wil be deserialized after retrieving....
3
by: Kristof Thys | last post by:
Hello, I'm writing a ASP.net webservice wich will visualize an image, generated by another application. The generated image is a char*. I can transform this to a String*, but I want to view it...
2
by: Chucker | last post by:
Hi Community, I think I can store Binary Data in SQL Server but when I try to retrieve it, I always only get one byte. I think I stored my Binary Data in SQL Server in a Colum of Type Image....
9
by: Tom John | last post by:
Hi I am storing images in an access database, based on an MSDN article. The code i use to store is as follows: <code> 'Create the command object Dim command As New...
3
by: Bama | last post by:
I already stored the image in the SQL database. How do I retrieve it? Any help is appreciated.
2
by: Ed | last post by:
Hope someone can help me out... I have been tasked to read some image data from an sql database and save the files to flat files. OK, sounds easy as I'v used BLOBs before. But this is an old...
1
by: keksy | last post by:
Hi every1, I am writing a small client/server application and in it I want to send an image asynchronous from the client to the server through a TCP socket. I found an example code on the MSDN...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.