Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can images be saved to Session State and retrieved?

Reply
Thread Tools

Can images be saved to Session State and retrieved?

 
 
=?Utf-8?B?Y2hhcmxpZXdlc3Q=?=
Guest
Posts: n/a
 
      07-31-2005
Hello -

I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is
there any way to temporarily save an image to a session object, and after
running some other operations, later retrieve the image from the session
object, convert it back to an image, and re-save it to the database?

Thanks?
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      07-31-2005
Why not? Check out the Bitmap class.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Hello -
>
> I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> is there any way to temporarily save an image to a session object, and
> after running some other operations, later retrieve the image from the
> session object, convert it back to an image, and re-save it to the
> database?
>
> Thanks?
>




 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmlqYXk=?=
Guest
Posts: n/a
 
      08-02-2005
Hi,

Why not covert the Image to Binary and then store it in session with the Img
format?
Is this a bad idea?

++Vijay R


"Brock Allen" wrote:

> Why not? Check out the Bitmap class.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
> > Hello -
> >
> > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > is there any way to temporarily save an image to a session object, and
> > after running some other operations, later retrieve the image from the
> > session object, convert it back to an image, and re-save it to the
> > database?
> >
> > Thanks?
> >

>
>
>
>

 
Reply With Quote
 
=?Utf-8?B?Y2hhcmxpZXdlc3Q=?=
Guest
Posts: n/a
 
      08-03-2005
Thanks Vijay,

As simple as this might sound, it's taking me forever. Could you pls point
me to some sample code?

The sample code i find, requires that i know the size and file type of the
image (bitmap) in the database, which i might not... I don't seem to find a
sample which is as "simple" as your solution seems to imply.

thanks

"Vijay" wrote:

> Hi,
>
> Why not covert the Image to Binary and then store it in session with the Img
> format?
> Is this a bad idea?
>
> ++Vijay R
>
>
> "Brock Allen" wrote:
>
> > Why not? Check out the Bitmap class.
> >
> > -Brock
> > DevelopMentor
> > http://staff.develop.com/ballen
> >
> >
> >
> > > Hello -
> > >
> > > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > > is there any way to temporarily save an image to a session object, and
> > > after running some other operations, later retrieve the image from the
> > > session object, convert it back to an image, and re-save it to the
> > > database?
> > >
> > > Thanks?
> > >

> >
> >
> >
> >

 
Reply With Quote
 
=?Utf-8?B?Y2hhcmxpZXdlc3Q=?=
Guest
Posts: n/a
 
      08-03-2005
Thanks Brock,

The bitmap class requires that i know that width and height of the image, to
first declare and instantiate the bitmap. Can this be done w/out know this
info? And, i'm also quite new at this, can you point me to some examples. I
have not found an example which enables me to save to session state and
retrieve. Only to save to file system... or retreive via stream with all of
the information coming from the stream object, which is difficult for me to
manipulate into an example that's right for me.

thanks,

"Brock Allen" wrote:

> Why not? Check out the Bitmap class.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>
> > Hello -
> >
> > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > is there any way to temporarily save an image to a session object, and
> > after running some other operations, later retrieve the image from the
> > session object, convert it back to an image, and re-save it to the
> > database?
> >
> > Thanks?
> >

>
>
>
>

 
Reply With Quote
 
=?Utf-8?B?VmlqYXk=?=
Guest
Posts: n/a
 
      08-04-2005
Hi,

I think this should work just for converting the bitmap to a byte stream:
--------------------------------------------------------------------
FileStream Fs = new
FileStream(TextBox2.Text.Trim(),FileMode.Open,File Access.Read);
byte[] RawData = new byte[Fs.Length];

Fs.Read(RawData,0,Convert.ToInt32(Fs.Length));
Fs.Close();

Session.Add("FileData",RawData);
-------------------------------------------------------------------

Now assuming that the file format is always bmp, we have to work on
converting it back into bmp.
will work on this

++Vijay R


"charliewest" wrote:

> Thanks Vijay,
>
> As simple as this might sound, it's taking me forever. Could you pls point
> me to some sample code?
>
> The sample code i find, requires that i know the size and file type of the
> image (bitmap) in the database, which i might not... I don't seem to find a
> sample which is as "simple" as your solution seems to imply.
>
> thanks
>
> "Vijay" wrote:
>
> > Hi,
> >
> > Why not covert the Image to Binary and then store it in session with the Img
> > format?
> > Is this a bad idea?
> >
> > ++Vijay R
> >
> >
> > "Brock Allen" wrote:
> >
> > > Why not? Check out the Bitmap class.
> > >
> > > -Brock
> > > DevelopMentor
> > > http://staff.develop.com/ballen
> > >
> > >
> > >
> > > > Hello -
> > > >
> > > > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > > > is there any way to temporarily save an image to a session object, and
> > > > after running some other operations, later retrieve the image from the
> > > > session object, convert it back to an image, and re-save it to the
> > > > database?
> > > >
> > > > Thanks?
> > > >
> > >
> > >
> > >
> > >

 
Reply With Quote
 
=?Utf-8?B?VmlqYXk=?=
Guest
Posts: n/a
 
      08-04-2005
Hi Charlie,

I wanted to ask,
How is the bitmap stored in the database? as a Blob or in bytes?
if it is stored in bytes, then I feel that Blob/Image is the better option.

you can insert the byte array as I mentioned before in the Image field of
the database.
For retrieving and displaying the image, put the byte array into a stream
and then create a bitmap file from the stream.

----------------------------------------------------------------------
MemoryStream stream = new MemoryStream(RawData, true);
stream.Write(RawData, 0, RawData.Length);

Bitmap bmp = new Bitmap(stream);
stream.close();
---------------------------------------------------------------------

Hope this helped

++Vijay R


"Vijay" wrote:

> Hi,
>
> I think this should work just for converting the bitmap to a byte stream:
> --------------------------------------------------------------------
> FileStream Fs = new
> FileStream(TextBox2.Text.Trim(),FileMode.Open,File Access.Read);
> byte[] RawData = new byte[Fs.Length];
>
> Fs.Read(RawData,0,Convert.ToInt32(Fs.Length));
> Fs.Close();
>
> Session.Add("FileData",RawData);
> -------------------------------------------------------------------
>
> Now assuming that the file format is always bmp, we have to work on
> converting it back into bmp.
> will work on this
>
> ++Vijay R
>
>
> "charliewest" wrote:
>
> > Thanks Vijay,
> >
> > As simple as this might sound, it's taking me forever. Could you pls point
> > me to some sample code?
> >
> > The sample code i find, requires that i know the size and file type of the
> > image (bitmap) in the database, which i might not... I don't seem to find a
> > sample which is as "simple" as your solution seems to imply.
> >
> > thanks
> >
> > "Vijay" wrote:
> >
> > > Hi,
> > >
> > > Why not covert the Image to Binary and then store it in session with the Img
> > > format?
> > > Is this a bad idea?
> > >
> > > ++Vijay R
> > >
> > >
> > > "Brock Allen" wrote:
> > >
> > > > Why not? Check out the Bitmap class.
> > > >
> > > > -Brock
> > > > DevelopMentor
> > > > http://staff.develop.com/ballen
> > > >
> > > >
> > > >
> > > > > Hello -
> > > > >
> > > > > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > > > > is there any way to temporarily save an image to a session object, and
> > > > > after running some other operations, later retrieve the image from the
> > > > > session object, convert it back to an image, and re-save it to the
> > > > > database?
> > > > >
> > > > > Thanks?
> > > > >
> > > >
> > > >
> > > >
> > > >

 
Reply With Quote
 
=?Utf-8?B?Y2hhcmxpZXdlc3Q=?=
Guest
Posts: n/a
 
      08-07-2005
Vijay,

First, i really appreciate your help sticking with this. I think i'm almost
there, but the examples i find (and that you provide) assume i pull the image
directly from the Web Form, and save the image to the Session State, and
then, pull the image from the session state. Where and how does the database
fit in?

I've been trying to do the following with zero luck:

byte[] RawData = new
byte[Convert.ToInt32(ds.Tables["Client"].Rows[0]["ImageSize"])];
MemoryStream stream = new MemoryStream(ds.Tables["Client"].Rows[0]["Image"],
FileMode.Open, FileAccess.Read);
Fs.Read(RawData, 0, Convert.ToInt32(Fs.Length));
Fs.Close();
Session["ImageByte"] = RawData;

And then....

Byte[] RawData = new byte[Convert.ToInt32(Session["ImageSize"].ToString())];
MemoryStream stream = new MemoryStream(RawData, true);
stream.Write(RawData, 0, RawData.Length);
Bitmap bmp = new Bitmap(stream);
stream.Close();

This is really going nowhere... i really am not catching how this conversion
between images, bytes and bitmaps is working....

If you could provide any insight on how the image is somehow saved to the a
session state var directly from the database, and how this is read from a
session state var... (which i think you've already provide in a former
response) that would be frankly amazing...

thanks,

"Vijay" wrote:

> Hi Charlie,
>
> I wanted to ask,
> How is the bitmap stored in the database? as a Blob or in bytes?
> if it is stored in bytes, then I feel that Blob/Image is the better option.
>
> you can insert the byte array as I mentioned before in the Image field of
> the database.
> For retrieving and displaying the image, put the byte array into a stream
> and then create a bitmap file from the stream.
>
> ----------------------------------------------------------------------
> MemoryStream stream = new MemoryStream(RawData, true);
> stream.Write(RawData, 0, RawData.Length);
>
> Bitmap bmp = new Bitmap(stream);
> stream.close();
> ---------------------------------------------------------------------
>
> Hope this helped
>
> ++Vijay R
>
>
> "Vijay" wrote:
>
> > Hi,
> >
> > I think this should work just for converting the bitmap to a byte stream:
> > --------------------------------------------------------------------
> > FileStream Fs = new
> > FileStream(TextBox2.Text.Trim(),FileMode.Open,File Access.Read);
> > byte[] RawData = new byte[Fs.Length];
> >
> > Fs.Read(RawData,0,Convert.ToInt32(Fs.Length));
> > Fs.Close();
> >
> > Session.Add("FileData",RawData);
> > -------------------------------------------------------------------
> >
> > Now assuming that the file format is always bmp, we have to work on
> > converting it back into bmp.
> > will work on this
> >
> > ++Vijay R
> >
> >
> > "charliewest" wrote:
> >
> > > Thanks Vijay,
> > >
> > > As simple as this might sound, it's taking me forever. Could you pls point
> > > me to some sample code?
> > >
> > > The sample code i find, requires that i know the size and file type of the
> > > image (bitmap) in the database, which i might not... I don't seem to find a
> > > sample which is as "simple" as your solution seems to imply.
> > >
> > > thanks
> > >
> > > "Vijay" wrote:
> > >
> > > > Hi,
> > > >
> > > > Why not covert the Image to Binary and then store it in session with the Img
> > > > format?
> > > > Is this a bad idea?
> > > >
> > > > ++Vijay R
> > > >
> > > >
> > > > "Brock Allen" wrote:
> > > >
> > > > > Why not? Check out the Bitmap class.
> > > > >
> > > > > -Brock
> > > > > DevelopMentor
> > > > > http://staff.develop.com/ballen
> > > > >
> > > > >
> > > > >
> > > > > > Hello -
> > > > > >
> > > > > > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > > > > > is there any way to temporarily save an image to a session object, and
> > > > > > after running some other operations, later retrieve the image from the
> > > > > > session object, convert it back to an image, and re-save it to the
> > > > > > database?
> > > > > >
> > > > > > Thanks?
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >

 
Reply With Quote
 
=?Utf-8?B?VmlqYXk=?=
Guest
Posts: n/a
 
      08-08-2005
Hi Charlie,

Okay I thought I had explained that, must have missed it somewhere.
here is the code to retrieve the image from the database.
Assuming that the column in the database table is defined as Image [image]
NULL in the table "Table1".

---------------------------------------------------------------------------------------------
//Retrieve Image from database
string strCmd = String.Format("SELECT Image FROM Table1 WHERE id = '1'",
SqlCommand Sqlcmd = new SqlCommand(strCmd, sqlConn);

byte[] bytImg = (byte[])Sqlcmd.ExecuteScalar();

//Store retrieved image in session

Session.Add("RawData",bytImg)

//Creating memory stream with the raw image data
System.IO.MemoryStream MemStrm = new System.IO.MemoryStream(bytImg, true);
MemStrm .Write(bytImg, 0, bytImg.Length);

//creating bitmap with the memory stream
Bitmap bmp = new Bitmap(MemStrm);
MemStrm.close();

------------------------------------------------------------------------------------------------
Hope this helped.

Regarding your code, I think you are missing something.
Firstly you created a byte array "RawData" filled it with the contents of
the dataset, where the col name was Imagesize. ->Now why is the image size a
byte? and why is it stored in the database? (okay giving you that you need
the image size)
Secondly you created a memory stream from another col of the dataset which
seems to be the Image. ->the image if stored in the database (in bytes)
should be retrieved to the byte array and then put into a memory stream.
Next you have used the file stream to read the "Rawdata" which now contains
the Image Size. -> why do you need a file stream to read the byte array? also
the byte array contains the image size!
lastly you are storing the image size (RawData) in the session ->assuming
you need the file size in the session, so what happened to the image in byte
form which was to be stored in the session? and which was in the memory
stream?

I understand what you want, but your code seems wrong or probably I am
missing something.
anyway try the code I gave you.
--
--Vijay R


"charliewest" wrote:

> Vijay,
>
> First, i really appreciate your help sticking with this. I think i'm almost
> there, but the examples i find (and that you provide) assume i pull the image
> directly from the Web Form, and save the image to the Session State, and
> then, pull the image from the session state. Where and how does the database
> fit in?
>
> I've been trying to do the following with zero luck:
>
> byte[] RawData = new
> byte[Convert.ToInt32(ds.Tables["Client"].Rows[0]["ImageSize"])];
> MemoryStream stream = new MemoryStream(ds.Tables["Client"].Rows[0]["Image"],
> FileMode.Open, FileAccess.Read);
> Fs.Read(RawData, 0, Convert.ToInt32(Fs.Length));
> Fs.Close();
> Session["ImageByte"] = RawData;
>
> And then....
>
> Byte[] RawData = new byte[Convert.ToInt32(Session["ImageSize"].ToString())];
> MemoryStream stream = new MemoryStream(RawData, true);
> stream.Write(RawData, 0, RawData.Length);
> Bitmap bmp = new Bitmap(stream);
> stream.Close();
>
> This is really going nowhere... i really am not catching how this conversion
> between images, bytes and bitmaps is working....
>
> If you could provide any insight on how the image is somehow saved to the a
> session state var directly from the database, and how this is read from a
> session state var... (which i think you've already provide in a former
> response) that would be frankly amazing...
>
> thanks,
>
> "Vijay" wrote:
>
> > Hi Charlie,
> >
> > I wanted to ask,
> > How is the bitmap stored in the database? as a Blob or in bytes?
> > if it is stored in bytes, then I feel that Blob/Image is the better option.
> >
> > you can insert the byte array as I mentioned before in the Image field of
> > the database.
> > For retrieving and displaying the image, put the byte array into a stream
> > and then create a bitmap file from the stream.
> >
> > ----------------------------------------------------------------------
> > MemoryStream stream = new MemoryStream(RawData, true);
> > stream.Write(RawData, 0, RawData.Length);
> >
> > Bitmap bmp = new Bitmap(stream);
> > stream.close();
> > ---------------------------------------------------------------------
> >
> > Hope this helped
> >
> > ++Vijay R
> >
> >
> > "Vijay" wrote:
> >
> > > Hi,
> > >
> > > I think this should work just for converting the bitmap to a byte stream:
> > > --------------------------------------------------------------------
> > > FileStream Fs = new
> > > FileStream(TextBox2.Text.Trim(),FileMode.Open,File Access.Read);
> > > byte[] RawData = new byte[Fs.Length];
> > >
> > > Fs.Read(RawData,0,Convert.ToInt32(Fs.Length));
> > > Fs.Close();
> > >
> > > Session.Add("FileData",RawData);
> > > -------------------------------------------------------------------
> > >
> > > Now assuming that the file format is always bmp, we have to work on
> > > converting it back into bmp.
> > > will work on this
> > >
> > > ++Vijay R
> > >
> > >
> > > "charliewest" wrote:
> > >
> > > > Thanks Vijay,
> > > >
> > > > As simple as this might sound, it's taking me forever. Could you pls point
> > > > me to some sample code?
> > > >
> > > > The sample code i find, requires that i know the size and file type of the
> > > > image (bitmap) in the database, which i might not... I don't seem to find a
> > > > sample which is as "simple" as your solution seems to imply.
> > > >
> > > > thanks
> > > >
> > > > "Vijay" wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Why not covert the Image to Binary and then store it in session with the Img
> > > > > format?
> > > > > Is this a bad idea?
> > > > >
> > > > > ++Vijay R
> > > > >
> > > > >
> > > > > "Brock Allen" wrote:
> > > > >
> > > > > > Why not? Check out the Bitmap class.
> > > > > >
> > > > > > -Brock
> > > > > > DevelopMentor
> > > > > > http://staff.develop.com/ballen
> > > > > >
> > > > > >
> > > > > >
> > > > > > > Hello -
> > > > > > >
> > > > > > > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > > > > > > is there any way to temporarily save an image to a session object, and
> > > > > > > after running some other operations, later retrieve the image from the
> > > > > > > session object, convert it back to an image, and re-save it to the
> > > > > > > database?
> > > > > > >
> > > > > > > Thanks?
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >

 
Reply With Quote
 
=?Utf-8?B?Y2hhcmxpZXdlc3Q=?=
Guest
Posts: n/a
 
      08-10-2005
Vijay,

First, thanks a ton for your help. This has not been fun i know. I've
managed to figure it out thanks to you. I don't know what i was trying to do
before so your comments are all well taken, but i've just followed what
you've suggested. There's still one thing i cannot do, but it's no longer an
issue: I can now pull the image from the db, and save to the session state,
as well as convert to a bitmap. But i still cannot pull the image from the
session state object and convert to bitmap. there's clearly something that
i'm missing... here's how my code that works looks:

//Retrieve Image from database
string strCmd = String.Format("SELECT Image FROM mClient WHERE (ClientId = "
+ Session["iClientId"].ToString() + ")");
using (SqlConnection cn = utils.GetConnection())
{
cn.Open();
SqlCommand Sqlcmd = new SqlCommand(strCmd, cn);
byte[] bytImg = (byte[])Sqlcmd.ExecuteScalar();

//Creating memory stream with the raw image data
System.IO.MemoryStream MemStrm = new System.IO.MemoryStream(bytImg, true);
MemStrm.Write(bytImg, 0, bytImg.Length);

//creating bitmap with the memory stream
Bitmap bmp = new Bitmap(MemStrm);
MemStrm.Close();

myData = bytImg;

cn.Close();
}

Thanks agian!

"Vijay" wrote:

> Hi Charlie,
>
> Okay I thought I had explained that, must have missed it somewhere.
> here is the code to retrieve the image from the database.
> Assuming that the column in the database table is defined as Image [image]
> NULL in the table "Table1".
>
> ---------------------------------------------------------------------------------------------
> //Retrieve Image from database
> string strCmd = String.Format("SELECT Image FROM Table1 WHERE id = '1'",
> SqlCommand Sqlcmd = new SqlCommand(strCmd, sqlConn);
>
> byte[] bytImg = (byte[])Sqlcmd.ExecuteScalar();
>
> //Store retrieved image in session
>
> Session.Add("RawData",bytImg)
>
> //Creating memory stream with the raw image data
> System.IO.MemoryStream MemStrm = new System.IO.MemoryStream(bytImg, true);
> MemStrm .Write(bytImg, 0, bytImg.Length);
>
> //creating bitmap with the memory stream
> Bitmap bmp = new Bitmap(MemStrm);
> MemStrm.close();
>
> ------------------------------------------------------------------------------------------------
> Hope this helped.
>
> Regarding your code, I think you are missing something.
> Firstly you created a byte array "RawData" filled it with the contents of
> the dataset, where the col name was Imagesize. ->Now why is the image size a
> byte? and why is it stored in the database? (okay giving you that you need
> the image size)
> Secondly you created a memory stream from another col of the dataset which
> seems to be the Image. ->the image if stored in the database (in bytes)
> should be retrieved to the byte array and then put into a memory stream.
> Next you have used the file stream to read the "Rawdata" which now contains
> the Image Size. -> why do you need a file stream to read the byte array? also
> the byte array contains the image size!
> lastly you are storing the image size (RawData) in the session ->assuming
> you need the file size in the session, so what happened to the image in byte
> form which was to be stored in the session? and which was in the memory
> stream?
>
> I understand what you want, but your code seems wrong or probably I am
> missing something.
> anyway try the code I gave you.
> --
> --Vijay R
>
>
> "charliewest" wrote:
>
> > Vijay,
> >
> > First, i really appreciate your help sticking with this. I think i'm almost
> > there, but the examples i find (and that you provide) assume i pull the image
> > directly from the Web Form, and save the image to the Session State, and
> > then, pull the image from the session state. Where and how does the database
> > fit in?
> >
> > I've been trying to do the following with zero luck:
> >
> > byte[] RawData = new
> > byte[Convert.ToInt32(ds.Tables["Client"].Rows[0]["ImageSize"])];
> > MemoryStream stream = new MemoryStream(ds.Tables["Client"].Rows[0]["Image"],
> > FileMode.Open, FileAccess.Read);
> > Fs.Read(RawData, 0, Convert.ToInt32(Fs.Length));
> > Fs.Close();
> > Session["ImageByte"] = RawData;
> >
> > And then....
> >
> > Byte[] RawData = new byte[Convert.ToInt32(Session["ImageSize"].ToString())];
> > MemoryStream stream = new MemoryStream(RawData, true);
> > stream.Write(RawData, 0, RawData.Length);
> > Bitmap bmp = new Bitmap(stream);
> > stream.Close();
> >
> > This is really going nowhere... i really am not catching how this conversion
> > between images, bytes and bitmaps is working....
> >
> > If you could provide any insight on how the image is somehow saved to the a
> > session state var directly from the database, and how this is read from a
> > session state var... (which i think you've already provide in a former
> > response) that would be frankly amazing...
> >
> > thanks,
> >
> > "Vijay" wrote:
> >
> > > Hi Charlie,
> > >
> > > I wanted to ask,
> > > How is the bitmap stored in the database? as a Blob or in bytes?
> > > if it is stored in bytes, then I feel that Blob/Image is the better option.
> > >
> > > you can insert the byte array as I mentioned before in the Image field of
> > > the database.
> > > For retrieving and displaying the image, put the byte array into a stream
> > > and then create a bitmap file from the stream.
> > >
> > > ----------------------------------------------------------------------
> > > MemoryStream stream = new MemoryStream(RawData, true);
> > > stream.Write(RawData, 0, RawData.Length);
> > >
> > > Bitmap bmp = new Bitmap(stream);
> > > stream.close();
> > > ---------------------------------------------------------------------
> > >
> > > Hope this helped
> > >
> > > ++Vijay R
> > >
> > >
> > > "Vijay" wrote:
> > >
> > > > Hi,
> > > >
> > > > I think this should work just for converting the bitmap to a byte stream:
> > > > --------------------------------------------------------------------
> > > > FileStream Fs = new
> > > > FileStream(TextBox2.Text.Trim(),FileMode.Open,File Access.Read);
> > > > byte[] RawData = new byte[Fs.Length];
> > > >
> > > > Fs.Read(RawData,0,Convert.ToInt32(Fs.Length));
> > > > Fs.Close();
> > > >
> > > > Session.Add("FileData",RawData);
> > > > -------------------------------------------------------------------
> > > >
> > > > Now assuming that the file format is always bmp, we have to work on
> > > > converting it back into bmp.
> > > > will work on this
> > > >
> > > > ++Vijay R
> > > >
> > > >
> > > > "charliewest" wrote:
> > > >
> > > > > Thanks Vijay,
> > > > >
> > > > > As simple as this might sound, it's taking me forever. Could you pls point
> > > > > me to some sample code?
> > > > >
> > > > > The sample code i find, requires that i know the size and file type of the
> > > > > image (bitmap) in the database, which i might not... I don't seem to find a
> > > > > sample which is as "simple" as your solution seems to imply.
> > > > >
> > > > > thanks
> > > > >
> > > > > "Vijay" wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > Why not covert the Image to Binary and then store it in session with the Img
> > > > > > format?
> > > > > > Is this a bad idea?
> > > > > >
> > > > > > ++Vijay R
> > > > > >
> > > > > >
> > > > > > "Brock Allen" wrote:
> > > > > >
> > > > > > > Why not? Check out the Bitmap class.
> > > > > > >
> > > > > > > -Brock
> > > > > > > DevelopMentor
> > > > > > > http://staff.develop.com/ballen
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > > Hello -
> > > > > > > >
> > > > > > > > I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
> > > > > > > > is there any way to temporarily save an image to a session object, and
> > > > > > > > after running some other operations, later retrieve the image from the
> > > > > > > > session object, convert it back to an image, and re-save it to the
> > > > > > > > database?
> > > > > > > >
> > > > > > > > Thanks?
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between asp session state and asp.net session state. archana ASP .Net 0 03-13-2007 11:42 AM
ASP.NET 2.0 Session State and ASP.NET 1.1 Session State jnickfl1 ASP .Net 0 09-18-2006 03:23 PM
Saved Mail Gone and Sent Mail Not Being Saved Gregg Firefox 6 03-06-2006 02:13 AM
Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. Mike Larkin ASP .Net 1 05-23-2005 12:33 PM
unable to make the session state request to the session state server shamanthakamani ASP .Net 1 11-20-2003 04:51 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57