Re: Can images be saved to Session State and retrieved?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

I think this should work just for converting the bitmap to a byte stream:
--------------------------------------------------------------------
FileStream Fs = new
FileStream(TextBox2.Text.Trim(),FileMode.Open,FileAccess.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?
> > > >
> > >
> > >
> > >
> > >
.



Relevant Pages

  • Re: Can images be saved to Session State and retrieved?
    ... Bitmap bmp = new Bitmap; ... "Vijay" wrote: ... > For retrieving and displaying the image, put the byte array into a stream ... > Bitmap bmp = new Bitmap; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: images and text
    ... See the FAQ and welcome.txt below. ... Converting text into an image or bitmap requires a font. ... Other fonts represent the font as ...
    (comp.lang.cpp)
  • Re: Grayscale VS. Bitmap
    ... > with solid blacks and clean, sharp edges. ... > Is converting to bitmap the only way to get solid blacks and clean, ... I have found that I get a nicer end result by scanning in grayscale, ... increasing the contrast in Photoshop dramatically, and then converting ...
    (comp.publish.prepress)
  • Re: fast way to Draw RGB/Grayscale Bitmap from a Double Matrix
    ... I am currently working on a project for image processing. ... the pixel of the corresponding bitmap. ... improvement by converting this block of code to C# using and unsafe code ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Convert color-image to bw *fast*
    ... My article on converting a colour image to a 1 bit per pixel image is ... to the bitmap data is via the Marshal class so that the code examples are ... public static void ConvertToBW(ref Bitmap objBmp) ... Bitmap objNewBmp = new Bitmap(objBmp.Width, objBmp.Height, ...
    (microsoft.public.dotnet.framework.drawing)