473,609 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="Bi nary" type="System.By te[]" >

Doing so, the binary data was saved in the "PropertyValues Binary" 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="Bi nary" type="System.By te[]"
customProviderD ata="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 3304
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="Bi nary" type="System.By te[]" >

Doing so, the binary data was saved in the "PropertyValues Binary" 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="Bi nary" type="System.By te[]"
customProviderD ata="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[] DeserializeImag e(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******** ********@TK2MSF TNGP03.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="Bi nary" type="System.By te[]" >

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

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

Therefore, I've altered the profile property like:
<add name="Photo" serializeAs="Bi nary" type="System.By te[]"
customProvider Data="image"/>

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

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
11753
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 table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
2
1778
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. However failde because the bytes seems to include some extra bytes with \0 and 0x01 and have 28 more bytes ahead of the original string. How could I deal with it? Just remove the first 28 bytes? It this method formal? I had thought the returned...
3
1721
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 as an image in my browser. Is this possible, and how should I do this? thx,
2
3742
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. At least when I execute the following code, I get some significant network traffic. When I check the database with query analyzer, I see 4 Hex Chars in the image colum. Like 0xe0 etc.
9
8764
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 OleDbCommand("ImageBlobUpdate", dataConnection) Command.CommandType = CommandType.StoredProcedure)
3
14936
by: Bama | last post by:
I already stored the image in the SQL database. How do I retrieve it? Any help is appreciated.
2
7376
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 database and I cannot get the image to work. The columns in the database are of type text. Here is one of the images text (in full) in the database (I hope you can see it):
1
7155
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 site, which is actually for sending strings. I tried to adapt this code so that the client sends an image instead of a string. However, there is something wrong on the server side (i guess)... The server starts listening, the client starts sending...
0
10748
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 inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
8109
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8035
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8509
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8374
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5502
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4059
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2502
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1630
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.